Skip to content

POC: Add workflow name to context scoped attributes and also on baggage(opt-in)#4446

Draft
wrisa wants to merge 3 commits intoopen-telemetry:mainfrom
wrisa:agent-workflow-baggage-context-scoped-attributes
Draft

POC: Add workflow name to context scoped attributes and also on baggage(opt-in)#4446
wrisa wants to merge 3 commits intoopen-telemetry:mainfrom
wrisa:agent-workflow-baggage-context-scoped-attributes

Conversation

@wrisa
Copy link
Copy Markdown
Contributor

@wrisa wrisa commented Apr 16, 2026

Description

Trying to prototype concepts in OTEP-open-telemetry/opentelemetry-specification#4931
Do not see any implementation changes for APIs and SDK for above OTEP. Created a key on Context for storing context-scoped attributes.
A key on Context is created to store workflow name when workflow invocation(parent) and fetched it using key while LLM invocation(child), updating the later invocation with it, see handler.py
Also added workflow name to baggage, opt-in on OTEL_PYTHON_GENAI_CAPTURE_BAGGAGE

Screenshot 2026-04-16 at 9 38 54 AM

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Copy link
Copy Markdown
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

I think this looks pretty cool, thanks for putting the PoC together.

I think handling scoped attributes would be useful for all SDK users, no just genai, so would prefer to see it in the core repo.

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.

5 participants