Repository navigation
fix(prometheus): retain main GC metrics under series saturation - #180103
Merged
steipete merged 1 commit intoOct 22, 2026
Merged
Conversation
Reserve the four native main-thread GC histograms before startup traffic can exhaust the shared series cap. Keep reservations invisible until observed and preserve worker totals and the existing cap.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
October 22, 2026 01:02
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
steipete
deleted the
steipete/perf-micro-main-gc-metric-missing-20260919
branch
October 22, 2026 01:12
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 22, 2026
…claw#180103) Reserve the four native main-thread GC histograms before startup traffic can exhaust the shared series cap. Keep reservations invisible until observed and preserve worker totals and the existing cap.
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.
What Problem This Solves
Fixes: main-thread GC histograms can stay absent forever when startup traffic fills the Prometheus exporter's shared 2,048-series cap before its first GC batch arrives.
User Impact
Native main-thread GC counts, total time, and duration buckets remain available under exporter saturation. Existing worker GC totals and the shared cap are preserved. No configuration or migration is required; restart into the fixed build to restore a saturated exporter.
Why This Change Was Made
The observer already rechecks late diagnostic interest every 30 seconds. The permanent loss is at metric admission: existing series continue updating, but newly arriving GC label sets are rejected once the shared budget is full. The additional retained worker metrics in #179872 (
548a331adb18) exposed this ordering problem.Reserve the four fixed native main-thread GC label sets when the exporter starts. Reservations consume the existing budget, remain invisible until a real collection arrives, and reset with the exporter. Counting and bucket aggregation still use the same histogram owner. Other GC label sets retain normal cap behavior.
Production code grows by 36 lines to add explicit, observation-free histogram reservation and its four bounded callers; this is an observability repair, not a speculative performance optimization. The old histogram admission/aggregation path is reused rather than duplicated.
Evidence
A synthetic loopback HTTP exporter reproduction initializes the GC observer before loading the plugin, records identical startup RPC and worker-memory traffic, then activates demand and forces one real native GC. It uses each revision's actual exporter sources with the unchanged diagnostic dispatcher/observer owner. All scrapes return HTTP 200:
5817d926548a331a^548a331a(#179872)4d35c3d2Fixed scrape:
The committed saturation regression fails on the original code and passes with the fix; it verifies late samples for all four native kinds, sums, and bucket counts without manufactured observations. The four focused exporter files pass (41 tests; 9.75 seconds wrapper wall time, including compilation). GC-owner tests pass (8 tests), and both requested closure guards pass (22 tests). Export-name collision guard, targeted extension typecheck (tsrs), formatting, and diff checks pass. Independent Codex review is clean for P0–P2; the subsequent test relocation and explicit undefined return only address lint. Changed-file lint passes. Exact-head PR CI provides broad validation.
Scope: real native GC, real diagnostic dispatch, and the exporter HTTP handler on loopback with synthetic state. This does not claim a full historical Gateway boot or a production deployment. Broad validation is delegated to PR CI; no Testbox lease or benchmark run was needed.