-
Notifications
You must be signed in to change notification settings - Fork 828
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
When using opentelemetry-ext-dbapi with django (using mysqlclient here), mysql component traces are being created with separate trace ids. This generates loads of traces which should instead be spans of the primary trace/request.
The separate mysql traces all seem to be from middleware (auth, sessions, cookies, custom, etc.) as well as system (migrations, content types, SHOW FULL TABLES, etc) ... the middleware traces should, at least, be contained as spans of the default trace. Can't filter them out, either.
e.g.
from opentelemetry import trace
from opentelemetry.instrumentation.dbapi import trace_integration
from opentelemetry.instrumentation.django import DjangoInstrumentor
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchExportSpanProcessor
from opentelemetry.sdk.trace.sampling import TraceIdRatioBased
import MySQLdb
# Instrument django
DjangoInstrumentor().instrument()
# Sample 1 in every 100 traces
sampler = TraceIdRatioBased(1/100)
# Set the sampler onto the global tracer provider
trace.set_tracer_provider(TracerProvider(sampler=sampler))
trace.get_tracer_provider().add_span_processor(BatchExportSpanProcessor())
# Instrument mysql
trace_integration(MySQLdb, "connect", "mysql", "sql")
=> 1 trace of component: http
=> multiple traces with different trace ids of component: mysql
Related to: #659
Since we have varying opinions about this, should it be made configurable?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working