You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add A365 telemetry correlation for WebSocket invocations - #48007
invocations_ws previously excluded WebSocket scopes from W3C trace propagation and did not attach the Agent 365 session baggage used to enrich spans created by customer handler code. This aligns WebSocket telemetry with the existing REST invocations behavior.
The change propagates incoming traceparent, tracestate, and baggage through the WebSocket lifecycle; attaches the canonical azure.ai.agentserver.session_id; and maps that context onto exported child spans and close-event logs. REST and WebSocket now share the existing core session key instead of defining protocol-specific duplicates.
Customer-code coverage creates and exports an explicit customer.websocket.process_message span, verifying its remote parent, instrumentation scope, custom attributes, A365 session correlation, and Foundry project identity. A hosted dual-protocol E2E run also confirmed the customer-created invocations_ws_a365_e2e span in Application Insights with session, agent, blueprint, and project enrichment.
The shared microsoft-opentelemetry optional OpenAI Agents instrumentation warning (ModuleNotFoundError: agents) reproduces for both REST and WebSocket and is intentionally unchanged.
Title of the pull request is clear and informative.
There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
Propagate W3C context through WebSocket scopes and attach the hosted session ID as A365 baggage for the connection lifecycle.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 811a430b-62e7-49b3-b426-45d1f28b04ef
Use the cross-protocol azure.ai.agentserver.session_id field for invocations_ws close-event telemetry, matching REST invocations and A365 correlation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 811a430b-62e7-49b3-b426-45d1f28b04ef
Remove the duplicate WebSocket session attribute constant and use the core tracing key in both invocation transports.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 811a430b-62e7-49b3-b426-45d1f28b04ef
Bump core to 2.0.0b8 and invocations to 1.0.0b7, and raise the
invocations core dependency to >=2.0.0b8. The repo core was still 2.0.0b7,
identical to the published PyPI 2.0.0b7 which lacks the new WebSocket
scope handling, so CI resolved the constraint to the published wheel and
the WS trace-context/baggage tests failed. The version bumps also align
_version.py with the top CHANGELOG entries so Verify-ChangeLogs passes.
Fix _FoundryEnrichmentSpanProcessor._on_ending for opentelemetry-sdk
1.43.0+, which now marks span attributes immutable before the on-ending
hook; temporarily clear the flag so agent identity attributes are applied.
Correct the invocations README to describe the actual per-connection
telemetry (context/baggage propagation + close-event log) instead of a
non-existent websocket_session span, and update the stale close-event
comment to note the session-ID key comes from the shared
_BAGGAGE_SESSION_ID in core.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 05a86c59-4ebd-4ec8-a42b-73b2e4ce94e0
This replaces the previously documented azure.ai.agentserver.invocations_ws.session_id close-event field rather than adding the shared key alongside it. Existing structured-log queries and processors will therefore lose session correlation, which contradicts the PR's “no breaking changes” declaration (the old field is documented in the 1.0.0b4 changelog). Preserve compatibility by emitting both keys for a transition period, or explicitly classify and document the schema change as breaking.
Resolve AgentServer release metadata against the active core 2.3.0b1 and invocations 1.3.0b1 preview lines.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b94aa89c-e288-46f2-8802-4f266ba8830e
Preserve the AgentServer telemetry changes alongside the new lifecycle APIs and record the normalized combined API snapshot.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b94aa89c-e288-46f2-8802-4f266ba8830e
Exercise callback export through an isolated Foundry enrichment processor so unsafe session baggage would fail the test if attached.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b94aa89c-e288-46f2-8802-4f266ba8830e
Move the core telemetry fix to unreleased 2.3.0b2 after the 2.3.0b1 release and align the invocations dependency floor.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b94aa89c-e288-46f2-8802-4f266ba8830e
Integrate the new Voice conversation-engine route with the existing propagation privacy boundary and preserve current API metadata and release notes.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b94aa89c-e288-46f2-8802-4f266ba8830e
Prevent caller baggage from overwriting server-authored telemetry fields and cover exported WebSocket close records with colliding baggage.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b94aa89c-e288-46f2-8802-4f266ba8830e
Filter the collision regression by the SDK close-event message so caller baggage on an earlier error log cannot select the wrong record.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b94aa89c-e288-46f2-8802-4f266ba8830e
Incoming baggage: microsoft.session.id=caller-session still breaks A365 session correlation for generic WebSocket handlers. Close-event extras contain the canonical and legacy session keys, but not microsoft.session.id, so this loop inserts the caller's alias. The session-resolution block below then skips the canonical session because the alias already exists. Exported close logs consequently use caller-session while handler spans use the SDK session. Skip the baggage alias when canonical session baggage is present, while preserving genuinely pre-existing log attributes. Extend the exporter regression to inject this alias and assert that exported microsoft.session.id matches the canonical session.
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
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.
Description
invocations_wspreviously excluded WebSocket scopes from W3C trace propagation and did not attach the Agent 365 session baggage used to enrich spans created by customer handler code. This aligns WebSocket telemetry with the existing RESTinvocationsbehavior.The change propagates incoming
traceparent,tracestate, and baggage through the WebSocket lifecycle; attaches the canonicalazure.ai.agentserver.session_id; and maps that context onto exported child spans and close-event logs. REST and WebSocket now share the existing core session key instead of defining protocol-specific duplicates.Customer-code coverage creates and exports an explicit
customer.websocket.process_messagespan, verifying its remote parent, instrumentation scope, custom attributes, A365 session correlation, and Foundry project identity. A hosted dual-protocol E2E run also confirmed the customer-createdinvocations_ws_a365_e2espan in Application Insights with session, agent, blueprint, and project enrichment.The shared
microsoft-opentelemetryoptional OpenAI Agents instrumentation warning (ModuleNotFoundError: agents) reproduces for both REST and WebSocket and is intentionally unchanged.Validation:
customer-ws-span-20260711T153708ZAll SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines