fix(logs): use handler span id for log correlation in X-Ray mode - #88
Open
dash0-app[bot] wants to merge 1 commit into
Open
fix(logs): use handler span id for log correlation in X-Ray mode#88dash0-app[bot] wants to merge 1 commit into
dash0-app[bot] wants to merge 1 commit into
Conversation
When DASH0_XRAY_TRACES_ENABLED=true, the extension skips creating supplementary spans (root span and init span). As a result, root_span_id is generated during handle_invoke_event but the corresponding span is never exported to the backend. Previously, get_trace_span_ids_for_logs always stamped logs with root_span_id, which caused the 'referenced span could not be found' error when opening a log record from the Span Context panel — the span id encoded in the log did not match any exported span. Fix: in X-Ray mode, use span_id (the handler span emitted by the OTel instrumentation layer) instead of root_span_id, since that span is always present in the trace. In the standard (non-X-Ray) path the behaviour is unchanged: logs are correlated to root_span_id (the supplementary root span), with a new fallback to span_id in case root_span_id has not yet been populated. Fixes SUP-1560
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
DASH0_XRAY_TRACES_ENABLED=true, the extension skips emitting supplementary spans (root span, init span). Aroot_span_idis still generated duringhandle_invoke_event, but the corresponding span is never exported to the backend.Previously
get_trace_span_ids_for_logsalways stamped logs withroot_span_id. Because no span with that id exists in the backend, Dash0 showed the errorThis log record has a trace context, but the referenced span could not be foundwhenever a user opened a log record from the Span Context panel.Changes
get_trace_span_ids_for_logsnow returnsspan_id(the handler span from the OTel instrumentation layer) instead ofroot_span_idwhen X-Ray mode is active.root_span_idtakes priority), with a new fallback tospan_idfor the early-arrival window beforeroot_span_idis populated.Context