-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix HTTP suppression in AI SDKs #41341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Fix HTTP suppression in AI SDKs by correcting context propagation to avoid duplicate HTTP spans
- Updated
change_context
calls to accept the span object instead of its internalspan_instance
across sync and async tracing - Added new tests to verify HTTP instrumentation suppression under custom contexts and auto-instrumentation policy
- Adjusted test imports to include
SansIOHTTPPolicy
and context API for suppression checks
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
sdk/core/azure-core-tracing-opentelemetry/tests/test_tracing_implementations.py | Added tests for HTTP suppression under change_context and auto-instrumentation policy; updated imports |
sdk/ai/azure-ai-inference/azure/ai/inference/tracing.py | Switched change_context usage to accept span instead of span.span_instance for both sync and async methods |
sdk/ai/azure-ai-agents/azure/ai/agents/telemetry/_ai_agents_instrumentor.py | Updated multiple change_context calls to accept the span object rather than its span_instance |
Comments suppressed due to low confidence (2)
sdk/core/azure-core-tracing-opentelemetry/tests/test_tracing_implementations.py:145
- The import 'HttpRequest' is not used in this test and can be removed to clean up unused dependencies.
from azure.core.rest import HttpRequest
sdk/core/azure-core-tracing-opentelemetry/tests/test_tracing_implementations.py:159
- The symbol 'PipelineClient' is not imported in this test, leading to a NameError. Add
from azure.core.pipeline import PipelineClient
at the top of the test.
self._client = PipelineClient(endpoint, policies=policies, transport=RequestsTransport())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change target to feature/azure-ai-agents/1.1.0b2 and feature/azure-ai-agents/1.0.1 for agents.
But I am not sure about the core and inference
@howieleung I'll send agent changes in a separate PR, please take another look at this one and #41361, #41362, thanks |
we currently produce duplicate HTTP spans when tracing inference and agents SDKs
It's caused by incorrect context propagation that in its turn leads to Azure SDK HTTP instrumentation being enabled along with underlying generic
requests
instrumentation.Fixing it.