Skip to content

docs: clarify baggage current context behavior#5397

Open
goutamadwant wants to merge 1 commit into
open-telemetry:mainfrom
goutamadwant:docs-baggage-current-context
Open

docs: clarify baggage current context behavior#5397
goutamadwant wants to merge 1 commit into
open-telemetry:mainfrom
goutamadwant:docs-baggage-current-context

Conversation

@goutamadwant

Copy link
Copy Markdown

Description

Clarifies that baggage helpers return updated Context values and do not attach those values as the current context automatically.

The docs now show the difference between reading baggage from an explicit context and reading baggage from the current context. They also include the context.attach / context.detach pattern needed when callers want a returned context to become current.

Fixes #2432

Type of change

  • This change requires a documentation update

How Has This Been Tested?

  • uv run tox -e docs
  • Ran the documented baggage/context snippets locally

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests are not applicable for this documentation-only change
  • Documentation has been updated

@goutamadwant goutamadwant requested a review from a team as a code owner July 7, 2026 00:53
Comment thread docs/api/context.rst
finally:
context.detach(token)

This is the same model used by :mod:`opentelemetry.baggage`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it's the other way around: baggage follows what is expected to do by the Context API.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. no need to mention Baggage here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Current context is empty with baggage.get_all

2 participants