Skip to content

Extract trace context onto an empty context - #1542

Merged
unflxw merged 1 commit into
wip-otel-reworkfrom
fix-otel-context-merge
Jul 16, 2026
Merged

Extract trace context onto an empty context#1542
unflxw merged 1 commit into
wip-otel-reworkfrom
fix-otel-context-merge

Conversation

@unflxw

@unflxw unflxw commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

The extract_rack_context and extract_job_context helpers called OpenTelemetry.propagation.extract without a context: argument, so it defaulted to Context.current. The W3C extractor returns its base context unchanged when the carrier has no traceparent, so a request with no incoming trace context inherited whatever span happened to be attached to the fiber.

In collector mode, that let a span left over from an earlier request become the parent of a later request's root span, merging unrelated requests into a single trace. Extract onto Context.empty instead, so extraction reflects only the carrier. A real incoming traceparent still parents (web) or links (jobs) exactly as before.

See #1544 for more on why there were spans left over from an earlier request in the first place.

[skip changeset]

The `extract_rack_context` and `extract_job_context` helpers called
`OpenTelemetry.propagation.extract` without a `context:` argument, so it
defaulted to `Context.current`. The W3C extractor returns its base
context unchanged when the carrier has no `traceparent`, so a request
with no incoming trace context inherited whatever span happened to be
attached to the fiber.

In collector mode that let a span left over from an earlier request
become the parent of a later request's root span, merging unrelated
requests into a single trace. Extract onto `Context.empty` instead, so
extraction reflects only the carrier. A real incoming `traceparent`
still parents (web) or links (jobs) exactly as before.
@backlog-helper

Copy link
Copy Markdown

Hi @unflxw,

We've found some issues with your Pull Request.

  • This Pull Request is missing labels. Please add labels to help identify types of Pull Requests. - (More info)
  • This Pull Request is missing reviewers. Either convert this Pull Request into a draft or ignore this rule by adding [skip review] to your Pull Request body. - (More info)

New issue guide | Backlog management | Rules | Feedback

@unflxw
unflxw merged commit 14c93c3 into wip-otel-rework Jul 16, 2026
408 checks passed
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.

1 participant