Semantic conventions for V8 JS engine runtime metrics

Status: Development

This document describes semantic conventions for V8 JS Engine Runtime metrics in OpenTelemetry. This engine is used in some JavaScript runtime such as Node.js and Deno.

Description: In-development V8 JS Engine Runtime metrics captured under v8js.

Metric: v8js.gc.duration

This metric is recommended.

This metric SHOULD be specified with ExplicitBucketBoundaries advisory parameter of [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ].

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
v8js.gc.durationHistogramsGarbage collection duration. [1]Development

[1]: The values can be retrieved from perf_hooks.PerformanceObserver(...).observe({ entryTypes: ['gc'] })

Attributes:

KeyStabilityRequirement LevelValue TypeDescriptionExample Values
v8js.gc.typeDevelopmentRequiredstringThe type of garbage collection.major; minor; incremental (see more)

v8js.gc.type has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
incrementalIncremental (Incremental Marking).Development
majorMajor (Mark Sweep Compact).Development
minorMinor (Scavenge).Development
weakcbWeak Callbacks (Process Weak Callbacks).Development

Metric: v8js.memory.heap.space.available_size

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
v8js.memory.heap.space.available_sizeUpDownCounterByHeap space available size. [1]Development

[1]: Value can be retrieved from value space_available_size of v8.getHeapSpaceStatistics()

Attributes:

KeyStabilityRequirement LevelValue TypeDescriptionExample Values
v8js.heap.space.nameDevelopmentRequiredstringThe name of the space type of heap memory. [1]new_space; old_space; code_space (see more)

[1] v8js.heap.space.name: Value can be retrieved from value space_name of v8.getHeapSpaceStatistics(). The set of reported spaces depends on the V8 version the runtime embeds.


v8js.heap.space.name has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
code_large_object_spaceLarge object space for code objects.Development
code_spaceCode memory space.Development
large_object_spaceLarge object memory space.Development
map_spaceMap memory space. [2]Development
new_large_object_spaceLarge object space for young-generation objects.Development
new_spaceNew memory space.Development
old_spaceOld memory space.Development
read_only_spaceRead-only memory space, holding immutable objects created at startup.Development
shared_large_object_spaceLarge object space for shared objects.Development
shared_spaceMemory space for objects shared across isolates (e.g. shared strings and structs).Development
shared_trusted_large_object_spaceLarge object space for shared trusted objects.Development
shared_trusted_spaceShared variant of the trusted memory space.Development
trusted_large_object_spaceLarge object space for trusted objects.Development
trusted_spaceMemory space for trusted objects kept outside the V8 sandbox (e.g. bytecode).Development

[2]: Only reported by Node.js <= 19; V8 merged the map space into the old space in V8 11.x.

Metric: v8js.memory.heap.space.physical_size

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
v8js.memory.heap.space.physical_sizeUpDownCounterByCommitted size of a heap space. [1]Development

[1]: Value can be retrieved from value physical_space_size of v8.getHeapSpaceStatistics()

Attributes:

KeyStabilityRequirement LevelValue TypeDescriptionExample Values
v8js.heap.space.nameDevelopmentRequiredstringThe name of the space type of heap memory. [1]new_space; old_space; code_space (see more)

[1] v8js.heap.space.name: Value can be retrieved from value space_name of v8.getHeapSpaceStatistics(). The set of reported spaces depends on the V8 version the runtime embeds.


v8js.heap.space.name has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
code_large_object_spaceLarge object space for code objects.Development
code_spaceCode memory space.Development
large_object_spaceLarge object memory space.Development
map_spaceMap memory space. [2]Development
new_large_object_spaceLarge object space for young-generation objects.Development
new_spaceNew memory space.Development
old_spaceOld memory space.Development
read_only_spaceRead-only memory space, holding immutable objects created at startup.Development
shared_large_object_spaceLarge object space for shared objects.Development
shared_spaceMemory space for objects shared across isolates (e.g. shared strings and structs).Development
shared_trusted_large_object_spaceLarge object space for shared trusted objects.Development
shared_trusted_spaceShared variant of the trusted memory space.Development
trusted_large_object_spaceLarge object space for trusted objects.Development
trusted_spaceMemory space for trusted objects kept outside the V8 sandbox (e.g. bytecode).Development

[2]: Only reported by Node.js <= 19; V8 merged the map space into the old space in V8 11.x.

Metric: v8js.memory.heap.space.size

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
v8js.memory.heap.space.sizeUpDownCounterByTotal heap memory size pre-allocated for a heap space. [1]Development

[1]: The value can be retrieved from value space_size of v8.getHeapSpaceStatistics()

Attributes:

KeyStabilityRequirement LevelValue TypeDescriptionExample Values
v8js.heap.space.nameDevelopmentRequiredstringThe name of the space type of heap memory. [1]new_space; old_space; code_space (see more)

[1] v8js.heap.space.name: Value can be retrieved from value space_name of v8.getHeapSpaceStatistics(). The set of reported spaces depends on the V8 version the runtime embeds.


v8js.heap.space.name has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
code_large_object_spaceLarge object space for code objects.Development
code_spaceCode memory space.Development
large_object_spaceLarge object memory space.Development
map_spaceMap memory space. [2]Development
new_large_object_spaceLarge object space for young-generation objects.Development
new_spaceNew memory space.Development
old_spaceOld memory space.Development
read_only_spaceRead-only memory space, holding immutable objects created at startup.Development
shared_large_object_spaceLarge object space for shared objects.Development
shared_spaceMemory space for objects shared across isolates (e.g. shared strings and structs).Development
shared_trusted_large_object_spaceLarge object space for shared trusted objects.Development
shared_trusted_spaceShared variant of the trusted memory space.Development
trusted_large_object_spaceLarge object space for trusted objects.Development
trusted_spaceMemory space for trusted objects kept outside the V8 sandbox (e.g. bytecode).Development

[2]: Only reported by Node.js <= 19; V8 merged the map space into the old space in V8 11.x.

Metric: v8js.memory.heap.used

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
v8js.memory.heap.usedUpDownCounterByHeap Memory size allocated. [1]Development

[1]: The value can be retrieved from value space_used_size of v8.getHeapSpaceStatistics()

Attributes:

KeyStabilityRequirement LevelValue TypeDescriptionExample Values
v8js.heap.space.nameDevelopmentRequiredstringThe name of the space type of heap memory. [1]new_space; old_space; code_space (see more)

[1] v8js.heap.space.name: Value can be retrieved from value space_name of v8.getHeapSpaceStatistics(). The set of reported spaces depends on the V8 version the runtime embeds.


v8js.heap.space.name has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
code_large_object_spaceLarge object space for code objects.Development
code_spaceCode memory space.Development
large_object_spaceLarge object memory space.Development
map_spaceMap memory space. [2]Development
new_large_object_spaceLarge object space for young-generation objects.Development
new_spaceNew memory space.Development
old_spaceOld memory space.Development
read_only_spaceRead-only memory space, holding immutable objects created at startup.Development
shared_large_object_spaceLarge object space for shared objects.Development
shared_spaceMemory space for objects shared across isolates (e.g. shared strings and structs).Development
shared_trusted_large_object_spaceLarge object space for shared trusted objects.Development
shared_trusted_spaceShared variant of the trusted memory space.Development
trusted_large_object_spaceLarge object space for trusted objects.Development
trusted_spaceMemory space for trusted objects kept outside the V8 sandbox (e.g. bytecode).Development

[2]: Only reported by Node.js <= 19; V8 merged the map space into the old space in V8 11.x.

Metric: v8js.resource.active

This metric is recommended.

NameInstrument TypeUnit (UCUM)DescriptionStabilityEntity Associations
v8js.resource.activeGauge{resource}Gauge of the active resources that are currently keeping the event loop alive. [1]Development

[1]: The values can be retrieved from process.getActiveResourcesInfo()

Attributes:

KeyStabilityRequirement LevelValue TypeDescriptionExample Values
v8js.resource.typeDevelopmentRequiredstringThe type of resource keeping the event loop active.Immediate; TCPServerWrap; TCPWrap (see more)

v8js.resource.type has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
ImmediateActive setImmediate callbacks.Development
TCPServerWrapActive TCP Servers.Development
TCPWrapActive TCP connections.Development
TimeoutActive setTimeout or setInterval timers.Development
TTYWrapActive Terminal I/O (stdin/stdout).Development