support service address and implement span links#218
Merged
nikhilNava merged 3 commits intomainfrom Apr 1, 2026
Merged
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the observability core SDK to support (1) propagating target server address/port via baggage for invoke-agent scenarios (to help auto-instrumentation), and (2) attaching OpenTelemetry span links to spans to represent causal relationships across async work.
Changes:
- Add
BaggageBuilder.invoke_agent_server(address, port)and propagateserver.address/server.portontoinvoke_agentspans via the span processor. - Add
SpanDetails.span_linksand wire span links throughOpenTelemetryScopeinto OTel span creation. - Refactor scope/span creation to use
SpanDetails(notably span kind) and add test coverage for span links and server address/port baggage propagation.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/observability/core/test_span_links.py | New tests validating that SpanDetails.span_links are forwarded to OTel spans across scope types. |
| tests/observability/core/test_record_attributes.py | Updates tests to pass span kind via SpanDetails instead of string kind=. |
| tests/observability/core/test_invoke_agent_scope.py | Adds test asserting server address/port baggage is propagated onto invoke-agent spans. |
| tests/observability/core/test_baggage_builder.py | Adds tests for the new invoke_agent_server() baggage builder method. |
| libraries/.../trace_processor/util.py | Updates the attribute allowlists used by the baggage-to-span span processor; adds server address/port to invoke-agent attributes. |
| libraries/.../spans_scopes/output_scope.py | Switches OutputScope to pass SpanDetails (and span links) into OpenTelemetryScope. |
| libraries/.../span_details.py | Adds span_links to SpanDetails. |
| libraries/.../opentelemetry_scope.py | Refactors constructor to accept SpanDetails and passes links= into tracer.start_span(...). |
| libraries/.../middleware/baggage_builder.py | Adds invoke_agent_server(address, port) to set server address/port baggage. |
| libraries/.../invoke_agent_scope.py | Refactors InvokeAgentScope span creation to use SpanDetails (including span links). |
| libraries/.../inference_scope.py | Refactors InferenceScope span creation to use SpanDetails (including span links). |
| libraries/.../execute_tool_scope.py | Refactors ExecuteToolScope span creation to use SpanDetails (including span links). |
...ents-a365-observability-core/microsoft_agents_a365/observability/core/opentelemetry_scope.py
Show resolved
Hide resolved
...ents-a365-observability-core/microsoft_agents_a365/observability/core/opentelemetry_scope.py
Show resolved
Hide resolved
...nts-a365-observability-core/microsoft_agents_a365/observability/core/trace_processor/util.py
Show resolved
Hide resolved
...65-observability-core/microsoft_agents_a365/observability/core/middleware/baggage_builder.py
Show resolved
Hide resolved
...365-observability-core/microsoft_agents_a365/observability/core/spans_scopes/output_scope.py
Outdated
Show resolved
Hide resolved
...t-agents-a365-observability-core/microsoft_agents_a365/observability/core/inference_scope.py
Outdated
Show resolved
Hide resolved
...gents-a365-observability-core/microsoft_agents_a365/observability/core/execute_tool_scope.py
Outdated
Show resolved
Hide resolved
...gents-a365-observability-core/microsoft_agents_a365/observability/core/invoke_agent_scope.py
Outdated
Show resolved
Hide resolved
fpfp100
approved these changes
Apr 1, 2026
...ents-a365-observability-core/microsoft_agents_a365/observability/core/opentelemetry_scope.py
Show resolved
Hide resolved
...nts-a365-observability-core/microsoft_agents_a365/observability/core/trace_processor/util.py
Show resolved
Hide resolved
juliomenendez
approved these changes
Apr 1, 2026
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.
Task
Add baggage builder method to support server address and port. Required for auto instrumentation.
Add span links to support async spans