Refactor code to use upstream SDKStatsManager#182
Merged
rads-1996 merged 12 commits intoJun 5, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the distro’s SDKStats implementation to rely on the upstream Azure Monitor exporter StatsbeatManager for feature/instrumentation gauges, while adding distro-owned network success-count gauges that attach to the upstream statsbeat pipeline.
Changes:
- Removed the distro’s standalone
SdkStatsManager/SdkStatsMetricsimplementation in favor of upstreamStatsbeatManager. - Added a standalone-path
StatsbeatConfigbuilder and a new_network_metricsmodule to export OTLP/A365 request success counts via upstream statsbeat. - Updated tests and distro initialization logic to reflect the new orchestration and idempotent gauge registration.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_sdkstats.py | Updated/added tests for upstream singleton resets, config builder, network gauge callback/registration, and new _initialize_sdkstats behavior. |
| src/microsoft/opentelemetry/_sdkstats/_utils.py | Updated comments to reflect that network gauges are now drained by _network_metrics. |
| src/microsoft/opentelemetry/_sdkstats/_network_metrics.py | New module that attaches distro network success-count callback(s) to upstream statsbeat gauges. |
| src/microsoft/opentelemetry/_sdkstats/_metrics.py | Removed the distro-owned observable gauge implementation. |
| src/microsoft/opentelemetry/_sdkstats/_manager.py | Removed the distro-owned SDKStats manager. |
| src/microsoft/opentelemetry/_sdkstats/_config.py | New helper to construct a default upstream StatsbeatConfig for standalone (non-Azure Monitor) scenarios. |
| src/microsoft/opentelemetry/_sdkstats/init.py | Updated package documentation and removed exported manager symbol. |
| src/microsoft/opentelemetry/_distro.py | Updated SDKStats initialization to bridge bits to upstream, initialize upstream manager in standalone mode, and register network gauges. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
lzchen
reviewed
Jun 3, 2026
lzchen
reviewed
Jun 3, 2026
lzchen
reviewed
Jun 3, 2026
lzchen
reviewed
Jun 3, 2026
lzchen
reviewed
Jun 3, 2026
lzchen
reviewed
Jun 3, 2026
lzchen
reviewed
Jun 3, 2026
lzchen
reviewed
Jun 3, 2026
lzchen
reviewed
Jun 3, 2026
lzchen
reviewed
Jun 3, 2026
Member
Author
44abc94 to
2aa7971
Compare
JacksonWeber
added a commit
that referenced
this pull request
Jun 4, 2026
* ci(perf): post sticky comment for fork PRs via workflow_run The Performance workflow runs in the PR context, which only grants a read-only GITHUB_TOKEN for pull requests from forks. As a result the "Post sticky PR comment" step was gated off for cross-repo PRs and the perf comparison never appeared on those PRs (e.g. #182). Move the comment posting into a new "Performance Comment" workflow triggered by workflow_run, which executes in the base repository context with pull-requests: write regardless of the PR's origin. The benchmarking workflow now records the PR number in pr-number.txt and uploads it alongside report.md so the follow-up workflow can target the correct PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci(perf): harden comment workflow per review Address Copilot review feedback on #186: * Treat the perf-results artifact as untrusted. Check out the base repo and regenerate report.md here from base.json/pr.json using the base-branch copy of perf.compare so the markdown posted under the writable GITHUB_TOKEN is never attacker-supplied by a fork PR. * Make actions/download-artifact non-fatal (continue-on-error) and gate every subsequent step on the download outcome, so a cancelled or failed upstream Performance run skips cleanly instead of marking the comment job as failed. * Validate that pr-number.txt contains a positive integer via regex before passing it to the sticky-comment action; skip cleanly if not. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JacksonWeber
approved these changes
Jun 4, 2026
Contributor
JacksonWeber
left a comment
There was a problem hiding this comment.
LGTM, replies to Leighton's comments make sense to me.
3370b0a to
99d85cc
Compare
Performance comparisonThreshold: regressions >15.0% on gating scenarios fail the build. Higher ops/s is better; positive Δ means the PR is slower.
|
lzchen
reviewed
Jun 5, 2026
lzchen
approved these changes
Jun 5, 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.



No description provided.