Modify sdkstats manager#47363
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the statsbeat system in azure-monitor-opentelemetry-exporter to allow SDKs/distros to register additional metric callbacks and have their observations included alongside the built-in statsbeat network metrics.
Changes:
- Add a callback registry and an
_iter_extra_observationshelper to safely aggregate extra observations from registered callbacks. - Add
StatsbeatManager.add_metric_callbackfor registering per-metric callbacks (idempotent per callback instance). - Update statsbeat network metric callbacks to append contributed observations, and add unit tests + changelog entry.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/statsbeat/_utils.py | Adds callback registry + iterator helper for contributed observations. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/statsbeat/_manager.py | Adds StatsbeatManager.add_metric_callback API for registering callbacks. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/statsbeat/_statsbeat_metrics.py | Appends extra observations to built-in network metrics callbacks. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/tests/statsbeat/test_metrics.py | Adds tests validating callback registration and observation aggregation behavior. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md | Documents the new callback capability under Features Added. |
d128d6f to
15b56f1
Compare
973cc6a to
79de717
Compare
rads-1996
commented
Jun 12, 2026
07aa1a0 to
2bd92fa
Compare
lzchen
reviewed
Jun 15, 2026
lzchen
reviewed
Jun 15, 2026
lzchen
reviewed
Jun 15, 2026
lzchen
reviewed
Jun 15, 2026
lzchen
reviewed
Jun 15, 2026
a6024d9 to
719e178
Compare
…r own metric observations to built-in statsbeat metrics
ce9acde to
719889c
Compare
lzchen
approved these changes
Jun 18, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The corresponding PR in
microsoft-opentelemetry- microsoft/opentelemetry-distro-python#191, currently the tests fail because they reference theadditional_callbacksfield which has been introduced in this PR.Once the exporter is released and the latest version is pinned in the microsoft opentelemetry distro, we would be able to merge the PR.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines