Skip to content

Wire the Agent365 example onto the OpenTelemetry SDK surface - #531

Open
heyitsaamir wants to merge 18 commits into
feature_agent365_supportfrom
heyitsaamir-agent365-otel-example
Open

Wire the Agent365 example onto the OpenTelemetry SDK surface#531
heyitsaamir wants to merge 18 commits into
feature_agent365_supportfrom
heyitsaamir-agent365-otel-example

Conversation

@heyitsaamir

Copy link
Copy Markdown
Collaborator

Summary

This is the top layer of the Python Agent365 OpenTelemetry stack, building on the automatic baggage bridge in #516 and the token-provider surface in #530. It makes those SDK seams runnable in the Agent365 example and mirrors the app-owned integration demonstrated by microsoft/teams.ts#679.

Decisions

  • Microsoft OpenTelemetry remains app-owned. microsoft-opentelemetry is declared only by examples/agent365; no SDK package imports it or acquires an exporter dependency. The lockfile change is comparatively large because Microsoft OTel 1.3.6 brings its supported Azure Monitor, OTLP, web-framework, HTTP, logging, and OpenAI instrumentation set transitively into the example environment.
  • Async token acquisition is bridged to the synchronous exporter contract. The example refreshes an Agentic App Instance token through app.token_provider before opening each Agent365 operation scope, then serves it from a synchronous in-memory resolver. This keeps credential ownership on the existing SDK token surface without blocking inside the exporter callback.
  • Correlation does not enable transcript capture. Sensitive-data export remains disabled, message bodies are not logged, and InvokeAgentScope is created without input or output content. The unused openai_agents instrumentation is explicitly disabled rather than adding an Agents SDK dependency.
  • Short-lived proactive sends flush explicitly. The proactive entry point force-flushes after its scoped work so the batching exporter does not lose the final operation when the process exits.

Deferred

SDK token and baggage behavior stays in the lower stack layers (#530 and #516); this PR intentionally contains only the runnable example, its app-level dependency/configuration, documentation, and generated lockfile.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8398c990-e5b5-41b6-8d04-0519128726c1
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8398c990-e5b5-41b6-8d04-0519128726c1
@heyitsaamir
heyitsaamir force-pushed the heyitsaamir-agent365-otel-example branch from 4509c93 to c0e53fe Compare July 30, 2026 20:50
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8398c990-e5b5-41b6-8d04-0519128726c1
@heyitsaamir
heyitsaamir force-pushed the heyitsaamir-agent365-otel-example branch from c0e53fe to 8051c45 Compare July 30, 2026 22:55
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8398c990-e5b5-41b6-8d04-0519128726c1
@heyitsaamir
heyitsaamir force-pushed the heyitsaamir-agent365-otel-example branch from 8051c45 to 192f898 Compare July 30, 2026 23:05
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8398c990-e5b5-41b6-8d04-0519128726c1
@heyitsaamir
heyitsaamir force-pushed the heyitsaamir-agent365-otel-example branch from 192f898 to 8272bb0 Compare July 30, 2026 23:11
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8398c990-e5b5-41b6-8d04-0519128726c1
@heyitsaamir
heyitsaamir force-pushed the heyitsaamir-agent365-otel-example branch from 8272bb0 to 7d219fa Compare July 30, 2026 23:59
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 8398c990-e5b5-41b6-8d04-0519128726c1
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0d367487-e88d-4423-8016-475637d47ed0
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0d367487-e88d-4423-8016-475637d47ed0
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0d367487-e88d-4423-8016-475637d47ed0
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0d367487-e88d-4423-8016-475637d47ed0
Build the Agent365 baggage bridge on the public token-provider layer. Establish identifier-only inbound baggage before the root turn span, support explicit opt-out and granular personal-data includes, and expose reusable proactive scopes without configuring exporters.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 0d367487-e88d-4423-8016-475637d47ed0
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 685066a8-363d-4fd6-b7a4-3a650db7b2cd
@heyitsaamir
heyitsaamir force-pushed the heyitsaamir-agent365-otel-example branch from 7d219fa to 4ed8f5d Compare July 31, 2026 00:04
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0d367487-e88d-4423-8016-475637d47ed0
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0d367487-e88d-4423-8016-475637d47ed0
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 685066a8-363d-4fd6-b7a4-3a650db7b2cd
Base automatically changed from heyitsaamir-python-otel-docs to feature_agent365_support July 31, 2026 04:02
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 685066a8-363d-4fd6-b7a4-3a650db7b2cd
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 685066a8-363d-4fd6-b7a4-3a650db7b2cd
await _handle_message(ctx)
return

await token_cache.refresh(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this runs before _handle_message, so should failed oauth be logged so message handling can continue without telemetry?

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.

2 participants