Skip to content

fix(tracing): report spans whose parent lives on another node - #1171

Open
solnic wants to merge 1 commit into
fix/otel-orphan-span-promotionfrom
fix/otel-remote-parent-spans
Open

fix(tracing): report spans whose parent lives on another node#1171
solnic wants to merge 1 commit into
fix/otel-orphan-span-promotionfrom
fix/otel-remote-parent-spans

Conversation

@solnic

@solnic solnic commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

When a service continued a trace from a traceparent and its local root was anything other than an HTTP-server / LiveView / Oban-consumer span etc., process_span/1 fell through to the server_span?/1 heuristic and the entire local subtree was silently dropped.

SpanRecord already carries OTel's parent_span_is_remote, so the local root of remotely-continued trace can be identified directly and reported as its own segment. build_trace_context/2 already passes parent_span_id through, so it nests under the upstream transaction.

This works on every supported opentelemetry version.

⚠️ parent_span_is_remote only exists on the span record from opentelemetry >= 1.6, so on 1.5.x (what Elixir 1.13/1.14 lock) the span processor derives it from the parent span context at on_start and carries it via an internal attribute that never reaches a payload.

Before

image

After

image

Fixes #1166

@solnic
solnic force-pushed the fix/otel-remote-parent-spans branch from 4b0ebed to a29744e Compare August 13, 2026 14:45
@solnic
solnic marked this pull request as ready for review August 13, 2026 14:45
Comment thread lib/sentry/opentelemetry/span_processor.ex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Distributed tracing: SpanProcessor drops every span under a remote parent unless it is kind: :server

1 participant