Skip to content

Make explicit context current in _start_as_current_typed_span - #5820

Draft
lmolkova wants to merge 1 commit into
lmolkova/span-type-api-sdkfrom
lmolkova/typed-span-context
Draft

lmolkova wants to merge 1 commit into
lmolkova/span-type-api-sdkfrom
lmolkova/typed-span-context

Conversation

@lmolkova

@lmolkova lmolkova commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Stacked on #5819.

Fixes #3350 for the new experimental method; see also #2432.

start_as_current_span(..., context=ctx) uses ctx only to find the parent. Inside the block, the current context is the caller's implicit context plus the span, so values in ctx such as baggage or custom keys aren't visible. That behavior is documented as intended for start_as_current_span and can't change there without breaking users.

_start_as_current_typed_span is new, so it can do what users expect: when context is passed, it becomes the current context for the block, with the new span set in it.

For tracers without span type support, the call is delegated to that tracer's start_as_current_span, so its existing behavior applies there.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-10-26 22:45 UTC

Move out of draft to request review.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@lmolkova
lmolkova force-pushed the lmolkova/typed-span-context branch from 3f8af1b to aa0b9d6 Compare October 23, 2026 23:37
@lmolkova
lmolkova added this pull request to stack #5822 October 24, 2026 01:05
@lmolkova
lmolkova force-pushed the lmolkova/typed-span-context branch from aa0b9d6 to 9cd9e8c Compare October 26, 2026 22:44

This branch has not been deployed

No deployments
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.

Explicit context passed to trace.start_as_current_span does not become current

1 participant