Add explicit custom baggage propagation - #264
Merged
Radhika Gupta (rads-1996) merged 19 commits intoSep 22, 2026
Merged
Radhika Gupta (rads-1996) merged 19 commits into
Radhika Gupta (rads-1996) merged 19 commits into
Conversation
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Performance comparisonThreshold: regressions >15.0% on gating scenarios fail the build. Higher ops/s is better; positive Δ means the PR is slower.
|
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
An explicit but unrecognized gen_ai.operation.name attribute classified a span as non-GenAI before the supported instrumentation-scope signal was evaluated, so opted-in custom baggage never reached real OpenAI Agents, LangChain, Agent Framework and openai_v2 spans whose operation is chain, embeddings, text_completion, generate_content or create_agent. The classifier now evaluates signals in order: a recognized explicit attribute yields GenAI with a known operation; an unrecognized explicit attribute stays authoritative over baggage and span-name inference but still falls through to instrumentation-scope detection; without an explicit attribute, recognized baggage, then span name, then scope apply. Scope-only recognition means GenAI with an unknown operation, so common and custom baggage may apply while invoke_agent-only attributes are withheld. Co-authored-by: Copilot <[email protected]>
Nikhil Navakiran (nikhilNava)
marked this pull request as ready for review
September 17, 2026 17:13
Copilot started reviewing on behalf of
Nikhil Navakiran (nikhilNava)
September 17, 2026 17:14
View session
Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Address the two moderate baggage-builder issues involving reserved metadata and nested-scope registrations.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds explicit custom baggage APIs and propagates opted-in keys to recognized GenAI spans.
Changes:
- Adds
custom_attribute()andcustom_attributes()APIs. - Updates propagation, tests, documentation, changelog, and samples.
File summaries
| File | Summary |
|---|---|
tests/a365/test_span_processor.py |
Tests propagation and span classification. |
tests/a365/test_baggage_builder.py |
Tests custom baggage behavior. |
src/microsoft/opentelemetry/a365/README.md |
Documents updated APIs. |
src/microsoft/opentelemetry/a365/core/middleware/baggage_builder.py |
Implements custom baggage tracking. set_pairs() can bypass opt-in, and nested scopes can lose inherited registrations. |
src/microsoft/opentelemetry/a365/core/exporters/span_processor.py |
Classifies GenAI spans and propagates selected keys. |
src/microsoft/opentelemetry/a365/core/constants.py |
Adds related constants. |
samples/microsoft_agent_framework/sample_maf_agent.py |
Formatting updates. |
samples/langchain/validate_traces.py |
Formatting updates. |
CHANGELOG.md |
Records the feature. |
A365_DOCUMENTATION.md |
Documents custom baggage usage. |
Review details
- Files reviewed: 9/10 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Nikhil Navakiran (nikhilNava)
deleted the
copilot/custom-baggage-propagation
branch
September 22, 2026 20:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Python parity for the custom baggage portion of microsoft/opentelemetry-distro-dotnet#116. Existing session ID support was already present.
Validation
Full mypy still reports the existing missing stubs for msal in an untouched module.