Repository navigation
fix(otel): Continue the incoming trace in OTEL spans - #1443
Open
sentry-junior[bot] wants to merge 2 commits into
Open
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
`SentryPropagator::extract_with_context` only stored the incoming `sentry-trace` header for `SentrySpanProcessor`, so OTEL gave the spans of a continued trace a new trace ID. The Sentry spans used the incoming trace ID, so OTEL and Sentry disagreed on the trace ID of the same span, e.g. for other OTEL exporters or for logs correlated by OTEL trace ID. `extract_with_context` now also sets a remote OTEL span context with the incoming trace and span IDs. The remote span is always marked as sampled, so OTEL records the spans and Sentry makes the sampling decision. Copying the incoming sampled flag instead would let OTEL's default `ParentBased` sampler drop the spans of unsampled traces, which unlinks errors from the incoming trace. The OTEL propagators of the Python, Ruby, Go, and Java SDKs also mark the remote span as sampled. This adds the public `TracePropagationContext::trace_id` and `TracePropagationContext::span_id` getters to `sentry-core`. Reproduction: getsentry/repro#96 References #1441 Co-Authored-By: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
Co-Authored-By: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
This branch has not been deployed
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.
Stacked on #1442.
SentryPropagator::extract_with_contextonly stored the incomingsentry-traceheader forSentrySpanProcessor, so OTEL gave the spans of a continued trace a new trace ID. The Sentry spans used the incoming trace ID, so OTEL and Sentry disagreed on the trace ID of the same span, e.g. for other OTEL exporters or for logs correlated by OTEL trace ID.extract_with_contextnow also sets a remote OTEL span context with the incoming trace and span IDs. The remote span is always marked as sampled, so OTEL records the spans and Sentry makes the sampling decision. Copying the incoming sampled flag instead would let OTEL's defaultParentBasedsampler drop the spans of unsampled traces, which unlinks errors from the incoming trace. The OTEL propagators of the Python, Ruby, Go, and Java SDKs also mark the remote span as sampled.This adds the public
TracePropagationContext::trace_idandTracePropagationContext::span_idgetters tosentry-core.Reproduction: getsentry/repro#96
References #1441
via @szokeasaurusrex.
--
View Session [Sentry]