Python: Require Azure Monitor 1.8.10 for Foundry trace propagation - #8512
Jose Alvarez (jpalvarezl) merged 17 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5641780c-318a-4def-8692-710b2b061c60
Separate per-agent project identity from exporter configuration, preserve export on optional discovery failures, and capture response identity from the owned chat result. Consolidate invocation telemetry state and document both setup paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bfc650ea-638e-4c20-aae6-f63cca98462e
Replace the experimental project-attribution and response-ID workaround with Azure Monitor 1.8.10 transport auto-instrumentation. Update the tracing samples, setup guidance and workspace lock, and cover W3C propagation through both Foundry helpers without network calls. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the tracing dependency and documentation fix without testing behavior owned by Azure Monitor. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve main's refreshed dependency resolution and Python 3.15 compatibility while retaining the Azure Monitor 1.8.10 minimum for tracing. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Prompt-agent setup documentation incorrectly presents the required agent version as optional.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates Foundry tracing guidance and dependencies so client and service spans share a trace.
Changes:
- Requires Azure Monitor OpenTelemetry 1.8.10+.
- Adds an existing-agent tracing sample with streaming support.
- Updates helper documentation and installation guidance.
File summaries
| File | Description |
|---|---|
python/uv.lock |
Records the Azure Monitor dependency constraint. |
python/pyproject.toml |
Raises the test dependency floor. |
python/packages/foundry/README.md |
Documents connected tracing setup. |
python/packages/foundry/agent_framework_foundry/_agent.py |
Updates helper guidance and installation error. |
python/packages/foundry/agent_framework_foundry/_chat_client.py |
Updates helper guidance and installation error. |
python/samples/02-agents/observability/README.md |
Adds setup and trace-inspection instructions. |
python/samples/02-agents/observability/foundry_agent_tracing.py |
Adds the existing-agent tracing sample. |
python/samples/02-agents/observability/foundry_tracing.py |
Updates dependency and cross-reference guidance. |
python/samples/02-agents/providers/foundry/README.md |
Links the new sample. |
Review details
- Files reviewed: 8/9 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (15 commit(s)): c133e29bf466, 2ac21147e0b5, c46ff52fccb4, 7180c5893298, 79db80942428, 7695b7ffd6d9, a3eeaee0c3b8, 807a12a7d750, 4f3b8b1b053f, 51f07df0a239, 394f0e74e941, 39279585c608, 3640474dd39c, c6781acdd17b, 3e972fa18801
Model: gpt-5.6-sol-fast
Overview
The PR consistently raises the optional Azure Monitor dependency floor to the version that instruments the OpenAI SDK's HTTPX transport, and adds an existing-agent sample that configures telemetry before either streaming or non-streaming invocation. Existing helper tests cover destination lookup, provider configuration, custom resources, missing dependencies, and missing Application Insights resources, while the sample preserves telemetry opt-out and sensitive-data defaults. No Critical, High, or Medium defect was established.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
Document FOUNDRY_AGENT_VERSION as required for PromptAgents and optional for HostedAgents, preserving runtime behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the package README focused on installation, the setup helper and the sample link. Retain sample prerequisites and run instructions without repeating the telemetry investigation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Motivation & Context
Foundry agent calls can export client spans to Application Insights while the agent's Foundry Traces view shows only server spans. With Azure Monitor OpenTelemetry 1.8.9, the OpenAI HTTP transport is not automatically instrumented, so requests can lack a W3C
traceparentheader and the service starts a separate trace.Azure Monitor OpenTelemetry 1.8.10 adds HTTPX/HTTPX2 auto-instrumentation. Using it connects the client and service spans in the existing agent's trace list and waterfall without custom project attribution or changes to agent identity and response handling.
Description & Review Guide
azure-monitor-opentelemetry>=1.8.10,<2in the workspace test dependency group and tracing samples. Add an existing-agent tracing sample supporting streaming and non-streaming calls, and update Foundry helper installation hints and tracing documentation.Related Issue
Fixes #7492
Supersedes the experimental attribution approach from the closed #7981. The earlier ARM-ID discovery and response-ID retention changes are not part of this fix.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after a language prefix) — a workflow keeps the label and the title prefix in sync automatically.The build and test confirmations cover the affected scope: the Foundry wheel and source distribution build cleanly; all Foundry unit tests and the core observability suite report 706 passed, 14 skipped, and 26 integration tests deselected. Four experimental/deprecation warnings remain in the test run. The full repository suite was not run; dependency-owned propagation tests are intentionally not added.