Skip to content

Commit

Permalink
re-add DjangoInstrumentor again to log username + id in response hook
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonavic committed Sep 23, 2024
1 parent 444d80f commit a718dd1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# Opentelemetry modules needed for logging and tracing
from opentelemetry import trace
from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
from opentelemetry.instrumentation.django import DjangoInstrumentor
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
from opentelemetry.sdk.resources import Resource
Expand Down Expand Up @@ -301,6 +302,7 @@ def __init__(self):
# Instrument the postgres database
# This will attach logs from the logger module to traces
Psycopg2Instrumentor().instrument(tracer_provider=tracer_provider, skip_dep_check=True)
DjangoInstrumentor().instrument(tracer_provider=tracer_provider, response_hook=response_hook)

LOGGING: dict[str, Any] = {
'version': 1,
Expand Down

0 comments on commit a718dd1

Please sign in to comment.