fix: widen v8js.gc.duration histogram buckets#1119
Merged
Conversation
The @opentelemetry/instrumentation-runtime-node default buckets for v8js.gc.duration are [10ms, 100ms, 1s, 10s], which lumps every incremental and minor GC pause into the first bucket and provides no resolution above 1s for long major collections. Add a View on this meter to use sub-millisecond boundaries from 100µs up through 30s, so incremental/minor pauses are distinguishable and major pauses above 1s land in their own buckets.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines OpenTelemetry metric aggregation for Node.js runtime GC pause durations by adding a scoped View override for the v8js.gc.duration histogram, improving resolution for sub-millisecond pauses and long major-GC events without affecting other metrics.
Changes:
- Adds a dedicated explicit-bucket boundary set for
v8js.gc.duration. - Registers a
Viewscoped tometerName: '@opentelemetry/instrumentation-runtime-node'andinstrumentName: 'v8js.gc.duration'to apply the new buckets.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage Report for CI Build 26215109574Coverage decreased (-0.003%) to 74.989%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
ferhatelmas
approved these changes
May 21, 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.
Summary
The
v8js.gc.durationhistogram emitted by@opentelemetry/instrumentation-runtime-nodeuses 4 hardcoded bucket boundaries:[10ms, 100ms, 1s, 10s]. This is one bucket per decade, which:This PR adds a
Viewon the runtime-node meter that overrides the buckets forv8js.gc.durationonly, with boundaries (in seconds):Sub-ms boundaries surface incremental/minor pauses; the 2.5s/5s/10s/30s tail keeps long major collections visible before the overflow bucket.
No other metric is affected — the override is scoped to
meterName: '@opentelemetry/instrumentation-runtime-node',instrumentName: 'v8js.gc.duration'.Test plan
npx tsc -noEmitnpm run lintnpx vitest run --config vitest.unit.config.ts src/internal/monitoring(69 tests pass)v8js_gc_duration_bucketseries in Prometheus/OTLP backend exposes the newlevalues and that incremental-kind samples populate buckets below 10ms.