Configure Agent Server trace sampling and instrumentation defaults - #48753
Configure Agent Server trace sampling and instrumentation defaults#48753Ankit Singhal (singankit) wants to merge 12 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Sets Azure Monitor trace sampling to 100% for Agent Server.
Changes:
- Configures
sampling_ratio=1.0. - Documents sampling behavior and adds tests.
- Adds a 2.1.1 changelog entry.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
_tracing.py |
Configures full Azure Monitor sampling. |
test_tracing.py |
Tests sampling arguments. |
README.md |
Documents sampling behavior. |
CHANGELOG.md |
Records the change. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
sdk/agentserver/azure-ai-agentserver-core/api.md:11
- This public API change updates
api.md, butapi.metadata.ymlis unchanged and still contains the hash for the previous API surface. The API metadata generator writesapiMdSha256from the normalizedapi.mdcontent (eng/scripts/extract_apiview_metadata.py:38-44), so the committed pair is now inconsistent. Regenerate the API stub/metadata and commit the resultingapi.metadata.ymlto avoid the API consistency check failing.
instrumentation_options: Optional[dict[str, dict[str, Any]]] = ...,
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
sdk/agentserver/azure-ai-agentserver-core/api.md:11
- Regenerate and commit
api.metadata.ymlwith this API snapshot change. Its committedapiMdSha256still describes the previousapi.md, while the repository's API-stub flow always hashes the normalized markdown and writes the metadata alongside it (eng/scripts/extract_apiview_metadata.py:38-44;eng/tools/azure-sdk-tools/azpysdk/apistub.py:235-255). Leaving the old hash makes the API snapshot internally inconsistent and will fail the API consistency check.
instrumentation_options: Optional[dict[str, dict[str, Any]]] = ...,
[Pilot] PR Pipeline Failure AnalysisWhat failedPipeline: python - pullrequest (Build Analyze) The Relevant pipeline outputRecommended next steps
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
sdk/agentserver/azure-ai-agentserver-core/api.md:11
- Updating
api.mdwithout regeneratingapi.metadata.ymlleaves the committedapiMdSha256stale. The repository’s API stub tooling writes both files together (eng/scripts/extract_apiview_metadata.py:38-44), and the package metadata is unchanged in this PR. Please regenerate the API stub and commit the matching metadata file so API consistency/artifact checks use the new surface.
instrumentation_options: Optional[dict[str, dict[str, Any]]] = ...,
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (2)
sdk/agentserver/azure-ai-agentserver-core/api.md:11
- The public API snapshot changed, but
api.metadata.ymlstill contains the previousapiMdSha256. The repository's API-stub workflow generates both files together (doc/dev/tests.md:150), so the API consistency check will reject this stale pair. Please rerunazpysdk apistub .from this package and commit the regenerated metadata.
instrumentation_options: Optional[dict[str, dict[str, Any]]] = ...,
sdk/agentserver/azure-ai-agentserver-core/CHANGELOG.md:3
- This new unreleased section targets 2.1.1, but the package's dynamic version source remains
VERSION = "2.1.0"inazure/ai/agentserver/core/_version.py:5, so builds still identify as the already released 2.1.0. Unreleased changelog versions are kept aligned with_version.pyelsewhere (for example, azure-ai-agentserver-optimization and azure-monitor-opentelemetry); please bump the version source to 2.1.1.
## 2.1.1 (Unreleased)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
sdk/agentserver/azure-ai-agentserver-core/tests/test_tracing.py:461
OTEL_TRACES_PER_SECONDis not consumed by the Microsoft distro; the rate-limited sampler reads its value fromOTEL_TRACES_SAMPLER_ARG(sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_utils/configurations.py:188-200). As written, this fixture sets an ignored variable and can mislead future changes about how the rate is configured. Use the standard sampler argument variable instead.
"OTEL_TRACES_PER_SECOND": "5",
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
sdk/agentserver/azure-ai-agentserver-core/tests/test_tracing.py:461
OTEL_TRACES_PER_SECONDis not the argument used by the Microsoft rate-limited sampler; it readsOTEL_TRACES_SAMPLER_ARG(azure/monitor/opentelemetry/_utils/configurations.py:188-200). As written, this test silently exercises the default value of 5 rather than the supplied configuration, so it would not catch loss of an explicit rate argument.
"OTEL_TRACES_PER_SECOND": "5",
sdk/agentserver/azure-ai-agentserver-core/tests/test_tracing_e2e.py:414
- This one-shot query cannot establish that the dependency was not exported: Application Insights ingestion is asynchronous, and the file explicitly allows up to 300 seconds for individual records to become queryable. The control span may be visible before its dependency, allowing this regression test to pass even when Azure SDK instrumentation is still enabled. Poll over the same ingestion window before asserting absence.
response = logs_query_client.query_resource(
appinsights_resource_id,
dependency_query,
timespan=timedelta(minutes=30),
)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
313c2c9 to
fb1097e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (1)
sdk/agentserver/azure-ai-agentserver-core/tests/test_tracing_e2e.py:416
- This single query can pass before Application Insights has indexed the dependency span. The file already treats ingestion as eventually consistent, and observing the control span does not guarantee that every span in the trace is queryable, so this test may report the instrumentation as disabled when the dependency arrives later. Observe the dependency query for a bounded delay before asserting absence, or rely on the deterministic local test instead of presenting this as a live negative check.
response = logs_query_client.query_resource(
appinsights_resource_id,
dependency_query,
timespan=timedelta(minutes=30),
)
dependency_rows = response.tables[0].rows if response.tables else []
assert dependency_rows == []
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df612ba-a75a-4a45-8fce-a5ed9f329e2f
Description
Configure Agent Server Core observability defaults to provide complete agent traces without noisy dependency spans:
microsoft.rate_limited, by omitting the default sampling ratio.configure_observability(instrumentation_options=...).2.1.1changelog entry.Validation
Trace comparison
Before
After
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines