-
Notifications
You must be signed in to change notification settings - Fork 489
Description
Tracer Version(s)
2.21.3
Python Version(s)
3.12.7
Pip Version(s)
24.0
Bug Report
When using google-pubsub opentelemetry feature with ddtrace's opentelemtry provider, I exposed an issue with the current implementation of the OpenTelemetry Span in this library. The following line in google-pubsub
span.get_span_context().trace_flags.sampled
Results in an "AttributeError: 'int' object has no attribute 'sampled'" error.
The root cause of the issue is in the following lines:
https://github.com/DataDog/dd-trace-py/blob/main/ddtrace/internal/opentelemetry/span.py#L148-L156
In this case TraceFlags.SAMPLED or TraceFlags.DEFAULT return an integer, not a TraceFlags instance, in order to get a TraceFlags instance you need to call TraceFlags.get_default() or TraceFlags(TraceFlags.SAMPLED), check the source code out here:
Reproduction Code
No response
Error Logs
No response
Libraries in Use
ddtrace: 2.21.3
opentelemetry: 1.30.0
google-cloud-pubsub: 2.28.0
Operating System
No response