You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In various languages like Java and JavaScript, the dd-trace library stores the 64-bit SpanContext._trace_id, with the additional higher-order bits of the trace ID stored in spanContext._trace.tags['_dd.p.tid']. However, for DDTracePy, the library takes a different approach by combining the 64-bit trace ID from the x-datadog-trace-id header with the higher-order bits from the _dd.p.tid header. Consequently, the SpanContext.trace_id in DDTracePy extends to 128 bits. This discrepancy leads to inconsistencies when attempting to retrieve the trace_id from SpanContext.
In our scenario, we aimed to utilize the trace_id as a uniform identifier for logging across various services. Unfortunately, the varied trace_id lengths across different DDTrace implementations have presented significant challenges for us. To mitigate these issues, we've been compelled to manually adjust the SpanContext.trace_id from 128 bits to 64 bits in all our Python-based services.
Hi @thanhj, one option for you could be to do something similar to this method whenever you grab the context.span_id. Just basically always make sure you're injecting the lower 64 bits into your logs to correlate. Would that work for your use case?
Hi @ZStriker19,
I didn't mean to find a workaround solution, as we already did it by shifting from 128-bit to 64-bit str((1 << 64) - 1 & context.trace_id).
However, I would suggest to treat the trace_id consistent to 64-bit to align with the other languages.
Summary of problem
In various languages like Java and JavaScript, the dd-trace library stores the 64-bit SpanContext._trace_id, with the additional higher-order bits of the trace ID stored in spanContext._trace.tags['_dd.p.tid']. However, for DDTracePy, the library takes a different approach by combining the 64-bit trace ID from the x-datadog-trace-id header with the higher-order bits from the _dd.p.tid header. Consequently, the SpanContext.trace_id in DDTracePy extends to 128 bits. This discrepancy leads to inconsistencies when attempting to retrieve the trace_id from SpanContext.
In our scenario, we aimed to utilize the trace_id as a uniform identifier for logging across various services. Unfortunately, the varied trace_id lengths across different DDTrace implementations have presented significant challenges for us. To mitigate these issues, we've been compelled to manually adjust the SpanContext.trace_id from 128 bits to 64 bits in all our Python-based services.
Which version of dd-trace-py are you using?
2.x
Which version of pip are you using?
N/A
Which libraries and their versions are you using?
N/A
References:
The text was updated successfully, but these errors were encountered: