Scope A365 baggage processing to GenAI spans - #265
Merged
Radhika Gupta (rads-1996) merged 11 commits intoSep 23, 2026
Merged
Radhika Gupta (rads-1996) merged 11 commits into
Radhika Gupta (rads-1996) merged 11 commits into
Conversation
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]>
A365SpanProcessor is registered when the TracerProvider is built, before the platform instrumentors attach their own processors, so its on_start hook runs before LangChain, Semantic Kernel, Agent Framework, and OpenAI Agents apply gen_ai.operation.name. LangChain chat spans start life named "ChatOpenAI" and Semantic Kernel ones as "chat.completions <model>", so the operation-attribute/baggage/span-name classifier skipped them and the spans lost tenant and agent identity, which made the exporter drop them. Add two span-start signals that are already available on a ReadWriteSpan: known pre-rename span names and the instrumentation scope (source) names of the supported GenAI instrumentations. Explicit operation attributes, recognized operation baggage, and precise span names keep their existing precedence and remain the only signals that classify which operation a span represents. The exporter allowlist is unchanged. 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, dropping 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 invoke_agent-only attributes are withheld. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Nikhil Navakiran (nikhilNava)
marked this pull request as ready for review
September 23, 2026 15:33
Copilot started reviewing on behalf of
Nikhil Navakiran (nikhilNava)
September 23, 2026 15:34
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The unconditional SOURCE_NAME scope can mutate unrelated spans, and documentation precedence needs correction.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Scopes A365 identity and baggage enrichment to recognized GenAI spans while preserving exporter filtering and no-overwrite behavior.
Changes:
- Adds GenAI classification by operation, span name, baggage, and instrumentation scope.
- Updates span processing, constants, tests, documentation, and changelog.
- Preserves existing exporter filtering behavior.
| File | Summary | Review note |
|---|---|---|
tests/a365/test_span_processor.py |
Adds classification and enrichment coverage. | — |
src/microsoft/opentelemetry/a365/README.md |
Documents scoped enrichment. | — |
src/microsoft/opentelemetry/a365/core/exporters/utils.py |
Clarifies exporter filtering. | — |
src/microsoft/opentelemetry/a365/core/exporters/span_processor.py |
Applies enrichment to classified spans. | — |
src/microsoft/opentelemetry/a365/core/constants.py |
Defines supported scopes and span names. | Moderate issue: SOURCE_NAME can enrich arbitrary Agent365Sdk spans. |
CHANGELOG.md |
Records behavior changes. | — |
A365_DOCUMENTATION.md |
Documents recognition and baggage behavior. | Nit: documented precedence differs from implementation. |
💡 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]>
Nikhil Navakiran (nikhilNava)
deleted the
copilot/genai-only-baggage
branch
September 23, 2026 20:32
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 microsoft/opentelemetry-distro-dotnet#99.
Validation