feat(instrumentation-runtime-node): add v8js.memory.heap.max metric from v8.getHeapStatistics()#3405
Open
Hronom wants to merge 1 commit intoopen-telemetry:mainfrom
Open
feat(instrumentation-runtime-node): add v8js.memory.heap.max metric from v8.getHeapStatistics()#3405Hronom wants to merge 1 commit intoopen-telemetry:mainfrom
Hronom wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
Contributor
|
just a drive by feedback (since this is marked as draft): before you make it ready for review, can you update the semantic convention for it? similar to open-telemetry/semantic-conventions#3445 |
Hronom
added a commit
to Hronom/semantic-conventions
that referenced
this pull request
Feb 26, 2026
Add v8js.memory.heap.max gauge metric representing the absolute maximum heap size (heap_size_limit) from v8.getHeapStatistics(). This value is the hard ceiling controlled by --max-old-space-size or V8 defaults. Related issue: open-telemetry#3476 Related instrumentation PR: open-telemetry/opentelemetry-js-contrib#3405
3 tasks
Author
|
Semantic conventions PR created: open-telemetry/semantic-conventions#3481 This adds the |
Author
|
Fixed lint |
maryliag
reviewed
Mar 3, 2026
packages/instrumentation-runtime-node/src/metrics/heapSizeLimitCollector.ts
Outdated
Show resolved
Hide resolved
New collector that calls v8.getHeapStatistics() and emits v8js.memory.heap.max metric representing the absolute maximum heap size (heap_size_limit). Related: open-telemetry/semantic-conventions#3476
99691cb to
7073049
Compare
Author
|
Fixed conflict |
Author
|
Please can someone review? |
Member
|
We're waiting on the upstream changes to the semantic conventions to be accepted, per this comment. |
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
Adds a new
v8js.memory.heap.maxmetric to@opentelemetry/instrumentation-runtime-nodethat exposes the absolute maximum heap size (heap_size_limit) fromv8.getHeapStatistics().Why
The existing V8 heap metrics (
v8js.memory.heap.limit,v8js.memory.heap.used, etc.) are all sourced fromv8.getHeapSpaceStatistics(), which provides per-space data. However, the absolute heap ceiling (heap_size_limit) -- controlled by--max-old-space-sizeor V8 defaults -- is only available fromv8.getHeapStatistics()and is not currently exposed.This value is critical for:
heap_used / heap_size_limit)Note:
v8js.memory.heap.limit(which maps tospace_sizefromgetHeapSpaceStatistics()) represents pre-allocated space size per heap space, not the hard OOM ceiling.Changes
src/semconv.ts-- AddedMETRIC_V8JS_MEMORY_HEAP_MAXconstantsrc/metrics/heapSizeLimitCollector.ts-- New collector usingv8.getHeapStatistics()and observingheap_size_limitas a gauge (unit: By)src/instrumentation.ts-- RegisteredHeapSizeLimitCollectoralongside existing collectorstest/heap_size_limit.test.ts-- Tests verifying metric is emitted as gauge with positive value and no per-space attributeSemantic Conventions
This metric is proposed in open-telemetry/semantic-conventions#3476. This PR is a draft pending the semconv discussion.
Checklist
Pull Request opened by Augment Code with guidance from the PR author