Modify sdkstats manager#47363
Open
rads-1996 wants to merge 6 commits into
Open
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. |
3e30c4d to
d128d6f
Compare
…r own metric observations to built-in statsbeat metrics
d128d6f to
15b56f1
Compare
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.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines