From 31a5b6363468ecefe9ea8b3bf63d258da95d949c Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Mon, 29 Sep 2025 22:06:23 -0700 Subject: [PATCH 1/4] chore(instrumentation-runtime-node): update semconv usage to modern exports Refs: https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2377 Refs: https://github.com/open-telemetry/opentelemetry-js/issues/5956 --- .../src/consts/attributes.ts | 16 -- .../src/instrumentation.ts | 17 +- .../src/metrics/baseCollector.ts | 8 +- .../src/metrics/eventLoopDelayCollector.ts | 91 +++------ .../src/metrics/eventLoopTimeCollector.ts | 25 ++- .../metrics/eventLoopUtilizationCollector.ts | 25 +-- .../src/metrics/gcCollector.ts | 22 +-- .../metrics/heapSpacesSizeAndUsedCollector.ts | 69 +++---- .../src/semconv.ts | 178 ++++++++++++++++++ .../src/types/ConventionalNamePrefix.ts | 19 -- .../test/event_loop_delay.test.ts | 28 +-- .../test/event_loop_time.test.ts | 17 +- .../test/event_loop_utilization.test.ts | 17 +- .../test/heap_space_and_used.test.ts | 53 +++--- 14 files changed, 324 insertions(+), 261 deletions(-) delete mode 100644 packages/instrumentation-runtime-node/src/consts/attributes.ts create mode 100644 packages/instrumentation-runtime-node/src/semconv.ts delete mode 100644 packages/instrumentation-runtime-node/src/types/ConventionalNamePrefix.ts diff --git a/packages/instrumentation-runtime-node/src/consts/attributes.ts b/packages/instrumentation-runtime-node/src/consts/attributes.ts deleted file mode 100644 index 5370097402..0000000000 --- a/packages/instrumentation-runtime-node/src/consts/attributes.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export const ATTR_V8JS_HEAP_SPACE_NAME = 'heap.space.name'; diff --git a/packages/instrumentation-runtime-node/src/instrumentation.ts b/packages/instrumentation-runtime-node/src/instrumentation.ts index 9f0e9c8250..9d0c0b441a 100644 --- a/packages/instrumentation-runtime-node/src/instrumentation.ts +++ b/packages/instrumentation-runtime-node/src/instrumentation.ts @@ -21,7 +21,6 @@ import { EventLoopUtilizationCollector } from './metrics/eventLoopUtilizationCol import { EventLoopDelayCollector } from './metrics/eventLoopDelayCollector'; import { GCCollector } from './metrics/gcCollector'; import { HeapSpacesSizeAndUsedCollector } from './metrics/heapSpacesSizeAndUsedCollector'; -import { ConventionalNamePrefix } from './types/ConventionalNamePrefix'; import { EventLoopTimeCollector } from './metrics/eventLoopTimeCollector'; /** @knipignore */ import { PACKAGE_VERSION, PACKAGE_NAME } from './version'; @@ -40,17 +39,11 @@ export class RuntimeNodeInstrumentation extends InstrumentationBase = { - [NodeJsEventLoopDelayAttributes.min]: { - description: 'Event loop minimum delay.', - }, - [NodeJsEventLoopDelayAttributes.max]: { - description: 'Event loop maximum delay.', - }, - [NodeJsEventLoopDelayAttributes.mean]: { - description: 'Event loop mean delay.', - }, - [NodeJsEventLoopDelayAttributes.stddev]: { - description: 'Event loop standard deviation delay.', - }, - [NodeJsEventLoopDelayAttributes.p50]: { - description: 'Event loop 50 percentile delay.', - }, - [NodeJsEventLoopDelayAttributes.p90]: { - description: 'Event loop 90 percentile delay.', - }, - [NodeJsEventLoopDelayAttributes.p99]: { - description: 'Event loop 99 percentile delay.', - }, -}; +import type { RuntimeNodeInstrumentationConfig } from '../types'; +import { BaseCollector } from './baseCollector'; export interface EventLoopLagInformation { min: number; @@ -69,11 +42,8 @@ export interface EventLoopLagInformation { export class EventLoopDelayCollector extends BaseCollector { private _histogram: IntervalHistogram; - constructor( - config: RuntimeNodeInstrumentationConfig = {}, - namePrefix: string - ) { - super(config, namePrefix); + constructor(config: RuntimeNodeInstrumentationConfig = {}) { + super(config); this._histogram = perf_hooks.monitorEventLoopDelay({ resolution: config.monitoringPrecision, }); @@ -81,58 +51,51 @@ export class EventLoopDelayCollector extends BaseCollector { updateMetricInstruments(meter: Meter): void { const delayMin = meter.createObservableGauge( - `${this.namePrefix}.${NodeJsEventLoopDelayAttributes.min}`, + METRIC_NODEJS_EVENTLOOP_DELAY_MIN, { - description: - metricNames[NodeJsEventLoopDelayAttributes.min].description, + description: 'Event loop minimum delay.', unit: 's', } ); const delayMax = meter.createObservableGauge( - `${this.namePrefix}.${NodeJsEventLoopDelayAttributes.max}`, + METRIC_NODEJS_EVENTLOOP_DELAY_MAX, { - description: - metricNames[NodeJsEventLoopDelayAttributes.max].description, + description: 'Event loop maximum delay.', unit: 's', } ); const delayMean = meter.createObservableGauge( - `${this.namePrefix}.${NodeJsEventLoopDelayAttributes.mean}`, + METRIC_NODEJS_EVENTLOOP_DELAY_MEAN, { - description: - metricNames[NodeJsEventLoopDelayAttributes.mean].description, + description: 'Event loop mean delay.', unit: 's', } ); const delayStddev = meter.createObservableGauge( - `${this.namePrefix}.${NodeJsEventLoopDelayAttributes.stddev}`, + METRIC_NODEJS_EVENTLOOP_DELAY_STDDEV, { - description: - metricNames[NodeJsEventLoopDelayAttributes.stddev].description, + description: 'Event loop standard deviation delay.', unit: 's', } ); const delayp50 = meter.createObservableGauge( - `${this.namePrefix}.${NodeJsEventLoopDelayAttributes.p50}`, + METRIC_NODEJS_EVENTLOOP_DELAY_P50, { - description: - metricNames[NodeJsEventLoopDelayAttributes.p50].description, + description: 'Event loop 50 percentile delay.', unit: 's', } ); const delayp90 = meter.createObservableGauge( - `${this.namePrefix}.${NodeJsEventLoopDelayAttributes.p90}`, + METRIC_NODEJS_EVENTLOOP_DELAY_P90, { - description: - metricNames[NodeJsEventLoopDelayAttributes.p90].description, + description: 'Event loop 90 percentile delay.', unit: 's', } ); const delayp99 = meter.createObservableGauge( - `${this.namePrefix}.${NodeJsEventLoopDelayAttributes.p99}`, + METRIC_NODEJS_EVENTLOOP_DELAY_P99, { - description: - metricNames[NodeJsEventLoopDelayAttributes.p99].description, + description: 'Event loop 99 percentile delay.', unit: 's', } ); diff --git a/packages/instrumentation-runtime-node/src/metrics/eventLoopTimeCollector.ts b/packages/instrumentation-runtime-node/src/metrics/eventLoopTimeCollector.ts index c8bf7a0f44..d5b86272d1 100644 --- a/packages/instrumentation-runtime-node/src/metrics/eventLoopTimeCollector.ts +++ b/packages/instrumentation-runtime-node/src/metrics/eventLoopTimeCollector.ts @@ -13,26 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { EventLoopUtilization, performance } from 'node:perf_hooks'; -import { RuntimeNodeInstrumentationConfig } from '../types'; + import { Meter } from '@opentelemetry/api'; + import { BaseCollector } from './baseCollector'; +import { + METRIC_NODEJS_EVENTLOOP_TIME, + ATTR_NODEJS_EVENTLOOP_STATE, + NODEJS_EVENTLOOP_STATE_VALUE_ACTIVE, + NODEJS_EVENTLOOP_STATE_VALUE_IDLE, +} from '../semconv'; const { eventLoopUtilization: eventLoopUtilizationCollector } = performance; -export const ATTR_NODEJS_EVENT_LOOP_TIME = 'eventloop.time'; - export class EventLoopTimeCollector extends BaseCollector { - constructor( - config: RuntimeNodeInstrumentationConfig = {}, - namePrefix: string - ) { - super(config, namePrefix); - } - public updateMetricInstruments(meter: Meter): void { const timeCounter = meter.createObservableCounter( - `${this.namePrefix}.${ATTR_NODEJS_EVENT_LOOP_TIME}`, + METRIC_NODEJS_EVENTLOOP_TIME, { description: 'Cumulative duration of time the event loop has been in each state.', @@ -48,10 +47,10 @@ export class EventLoopTimeCollector extends BaseCollector { if (data === undefined) return; observableResult.observe(timeCounter, data.active / 1000, { - [`${this.namePrefix}.eventloop.state`]: 'active', + [ATTR_NODEJS_EVENTLOOP_STATE]: NODEJS_EVENTLOOP_STATE_VALUE_ACTIVE, }); observableResult.observe(timeCounter, data.idle / 1000, { - [`${this.namePrefix}.eventloop.state`]: 'idle', + [ATTR_NODEJS_EVENTLOOP_STATE]: NODEJS_EVENTLOOP_STATE_VALUE_IDLE, }); }, [timeCounter] diff --git a/packages/instrumentation-runtime-node/src/metrics/eventLoopUtilizationCollector.ts b/packages/instrumentation-runtime-node/src/metrics/eventLoopUtilizationCollector.ts index 97a5642708..0be3c8f016 100644 --- a/packages/instrumentation-runtime-node/src/metrics/eventLoopUtilizationCollector.ts +++ b/packages/instrumentation-runtime-node/src/metrics/eventLoopUtilizationCollector.ts @@ -13,34 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { EventLoopUtilization, performance } from 'node:perf_hooks'; -import { RuntimeNodeInstrumentationConfig } from '../types'; + import { Meter } from '@opentelemetry/api'; + import { BaseCollector } from './baseCollector'; +import { METRIC_NODEJS_EVENTLOOP_UTILIZATION } from '../semconv'; const { eventLoopUtilization: eventLoopUtilizationCollector } = performance; -export const ATTR_NODEJS_EVENT_LOOP_UTILIZATION = 'eventloop.utilization'; - export class EventLoopUtilizationCollector extends BaseCollector { private _lastValue?: EventLoopUtilization; - constructor( - config: RuntimeNodeInstrumentationConfig = {}, - namePrefix: string - ) { - super(config, namePrefix); - } - public updateMetricInstruments(meter: Meter): void { meter - .createObservableGauge( - `${this.namePrefix}.${ATTR_NODEJS_EVENT_LOOP_UTILIZATION}`, - { - description: 'Event loop utilization', - unit: '1', - } - ) + .createObservableGauge(METRIC_NODEJS_EVENTLOOP_UTILIZATION, { + description: 'Event loop utilization', + unit: '1', + }) .addCallback(async observableResult => { if (!this._config.enabled) return; diff --git a/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts b/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts index c262aebc2e..e376dd70df 100644 --- a/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts +++ b/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts @@ -13,14 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { RuntimeNodeInstrumentationConfig } from '../types'; + +import * as perf_hooks from 'node:perf_hooks'; +import { PerformanceObserver } from 'node:perf_hooks'; + import { Meter } from '@opentelemetry/api'; + +import { RuntimeNodeInstrumentationConfig } from '../types'; import { Histogram, ValueType } from '@opentelemetry/api'; import { BaseCollector } from './baseCollector'; -import * as perf_hooks from 'node:perf_hooks'; -import { PerformanceObserver } from 'node:perf_hooks'; +import { ATTR_V8JS_GC_TYPE, METRIC_V8JS_GC_DURATION } from '../semconv'; -const ATTR_NODEJS_GC_DURATION_SECONDS = 'gc.duration'; const DEFAULT_GC_DURATION_BUCKETS = [0.01, 0.1, 1, 10]; const kinds: string[] = []; @@ -33,11 +36,8 @@ export class GCCollector extends BaseCollector { private _gcDurationByKindHistogram?: Histogram; private _observer: PerformanceObserver; - constructor( - config: RuntimeNodeInstrumentationConfig = {}, - namePrefix: string - ) { - super(config, namePrefix); + constructor(config: RuntimeNodeInstrumentationConfig = {}) { + super(config); this._observer = new perf_hooks.PerformanceObserver(list => { if (!this._config.enabled) return; @@ -50,14 +50,14 @@ export class GCCollector extends BaseCollector { const kind = entry.detail ? kinds[entry.detail.kind] : kinds[entry.kind]; this._gcDurationByKindHistogram?.record( entry.duration / 1000, - Object.assign({ [`${this.namePrefix}.gc.type`]: kind }) + { [ATTR_V8JS_GC_TYPE]: kind } ); }); } updateMetricInstruments(meter: Meter): void { this._gcDurationByKindHistogram = meter.createHistogram( - `${this.namePrefix}.${ATTR_NODEJS_GC_DURATION_SECONDS}`, + METRIC_V8JS_GC_DURATION, { description: 'Garbage collection duration by kind, one of major, minor, incremental or weakcb.', diff --git a/packages/instrumentation-runtime-node/src/metrics/heapSpacesSizeAndUsedCollector.ts b/packages/instrumentation-runtime-node/src/metrics/heapSpacesSizeAndUsedCollector.ts index 27582cb0fd..f0d3d69270 100644 --- a/packages/instrumentation-runtime-node/src/metrics/heapSpacesSizeAndUsedCollector.ts +++ b/packages/instrumentation-runtime-node/src/metrics/heapSpacesSizeAndUsedCollector.ts @@ -13,74 +13,51 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { RuntimeNodeInstrumentationConfig } from '../types'; -import { Meter } from '@opentelemetry/api'; -import { BaseCollector } from './baseCollector'; + import * as v8 from 'node:v8'; -import { HeapSpaceInfo } from 'v8'; -import { ATTR_V8JS_HEAP_SPACE_NAME } from '../consts/attributes'; +import type { HeapSpaceInfo } from 'v8'; -export enum V8HeapSpaceMetrics { - heapLimit = 'memory.heap.limit', - used = 'memory.heap.used', - available = 'memory.heap.space.available_size', - physical = 'memory.heap.space.physical_size', -} +import { Meter } from '@opentelemetry/api'; -export const metricNames: Record = - { - [V8HeapSpaceMetrics.heapLimit]: { - description: 'Total heap memory size pre-allocated.', - }, - [V8HeapSpaceMetrics.used]: { - description: 'Heap Memory size allocated.', - }, - [V8HeapSpaceMetrics.available]: { - description: 'Heap space available size.', - }, - [V8HeapSpaceMetrics.physical]: { - description: 'Committed size of a heap space.', - }, - }; +import { BaseCollector } from './baseCollector'; +import { + ATTR_V8JS_HEAP_SPACE_NAME, + METRIC_V8JS_MEMORY_HEAP_LIMIT, + METRIC_V8JS_MEMORY_HEAP_USED, +} from '../semconv'; export class HeapSpacesSizeAndUsedCollector extends BaseCollector { - constructor( - config: RuntimeNodeInstrumentationConfig = {}, - namePrefix: string - ) { - super(config, namePrefix); - } - updateMetricInstruments(meter: Meter): void { const heapLimit = meter.createObservableGauge( - `${this.namePrefix}.${V8HeapSpaceMetrics.heapLimit}`, + METRIC_V8JS_MEMORY_HEAP_LIMIT, { - description: metricNames[V8HeapSpaceMetrics.heapLimit].description, + description: 'Total heap memory size pre-allocated.', unit: 'By', } ); const heapSpaceUsed = meter.createObservableGauge( - `${this.namePrefix}.${V8HeapSpaceMetrics.used}`, + METRIC_V8JS_MEMORY_HEAP_USED, { - description: metricNames[V8HeapSpaceMetrics.used].description, + description: 'Heap Memory size allocated.', unit: 'By', } ); const heapSpaceAvailable = meter.createObservableGauge( - `${this.namePrefix}.${V8HeapSpaceMetrics.available}`, + // TODO: fix to use METRIC_V8JS_HEAP_SPACE_AVAILABLE_SIZE (breaking change) + 'v8js.memory.heap.space.available_size', { - description: metricNames[V8HeapSpaceMetrics.available].description, + description: 'Heap space available size.', unit: 'By', } ); const heapSpacePhysical = meter.createObservableGauge( - `${this.namePrefix}.${V8HeapSpaceMetrics.physical}`, + // TODO: fix to use METRIC_V8JS_HEAP_SPACE_PHYSICAL_SIZE (breaking change) + 'v8js.memory.heap.space.physical_size', { - description: metricNames[V8HeapSpaceMetrics.physical].description, + description: 'Committed size of a heap space.', unit: 'By', } ); - const heapSpaceNameAttributeName = `${this.namePrefix}.${ATTR_V8JS_HEAP_SPACE_NAME}`; meter.addBatchObservableCallback( observableResult => { @@ -92,18 +69,18 @@ export class HeapSpacesSizeAndUsedCollector extends BaseCollector { const spaceName = space.space_name; observableResult.observe(heapLimit, space.space_size, { - [heapSpaceNameAttributeName]: spaceName, + [ATTR_V8JS_HEAP_SPACE_NAME]: spaceName, }); observableResult.observe(heapSpaceUsed, space.space_used_size, { - [heapSpaceNameAttributeName]: spaceName, + [ATTR_V8JS_HEAP_SPACE_NAME]: spaceName, }); observableResult.observe( heapSpaceAvailable, space.space_available_size, { - [heapSpaceNameAttributeName]: spaceName, + [ATTR_V8JS_HEAP_SPACE_NAME]: spaceName, } ); @@ -111,7 +88,7 @@ export class HeapSpacesSizeAndUsedCollector extends BaseCollector { heapSpacePhysical, space.physical_space_size, { - [heapSpaceNameAttributeName]: spaceName, + [ATTR_V8JS_HEAP_SPACE_NAME]: spaceName, } ); } diff --git a/packages/instrumentation-runtime-node/src/semconv.ts b/packages/instrumentation-runtime-node/src/semconv.ts new file mode 100644 index 0000000000..1c6eadd436 --- /dev/null +++ b/packages/instrumentation-runtime-node/src/semconv.ts @@ -0,0 +1,178 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This file contains a copy of unstable semantic convention definitions + * used by this package. + * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv + */ + +/** + * The state of event loop time. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_NODEJS_EVENTLOOP_STATE = 'nodejs.eventloop.state' as const; + +/** + * The type of garbage collection. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_V8JS_GC_TYPE = 'v8js.gc.type' as const; + +/** + * The name of the space type of heap memory. + * + * @note Value can be retrieved from value `space_name` of [`v8.getHeapSpaceStatistics()`](https://nodejs.org/api/v8.html#v8getheapspacestatistics) + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_V8JS_HEAP_SPACE_NAME = 'v8js.heap.space.name' as const; + +/** + * Event loop maximum delay. + * + * @note Value can be retrieved from value `histogram.max` of [`perf_hooks.monitorEventLoopDelay([options])`](https://nodejs.org/api/perf_hooks.html#perf_hooksmonitoreventloopdelayoptions) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_NODEJS_EVENTLOOP_DELAY_MAX = + 'nodejs.eventloop.delay.max' as const; + +/** + * Event loop mean delay. + * + * @note Value can be retrieved from value `histogram.mean` of [`perf_hooks.monitorEventLoopDelay([options])`](https://nodejs.org/api/perf_hooks.html#perf_hooksmonitoreventloopdelayoptions) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_NODEJS_EVENTLOOP_DELAY_MEAN = + 'nodejs.eventloop.delay.mean' as const; + +/** + * Event loop minimum delay. + * + * @note Value can be retrieved from value `histogram.min` of [`perf_hooks.monitorEventLoopDelay([options])`](https://nodejs.org/api/perf_hooks.html#perf_hooksmonitoreventloopdelayoptions) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_NODEJS_EVENTLOOP_DELAY_MIN = + 'nodejs.eventloop.delay.min' as const; + +/** + * Event loop 50 percentile delay. + * + * @note Value can be retrieved from value `histogram.percentile(50)` of [`perf_hooks.monitorEventLoopDelay([options])`](https://nodejs.org/api/perf_hooks.html#perf_hooksmonitoreventloopdelayoptions) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_NODEJS_EVENTLOOP_DELAY_P50 = + 'nodejs.eventloop.delay.p50' as const; + +/** + * Event loop 90 percentile delay. + * + * @note Value can be retrieved from value `histogram.percentile(90)` of [`perf_hooks.monitorEventLoopDelay([options])`](https://nodejs.org/api/perf_hooks.html#perf_hooksmonitoreventloopdelayoptions) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_NODEJS_EVENTLOOP_DELAY_P90 = + 'nodejs.eventloop.delay.p90' as const; + +/** + * Event loop 99 percentile delay. + * + * @note Value can be retrieved from value `histogram.percentile(99)` of [`perf_hooks.monitorEventLoopDelay([options])`](https://nodejs.org/api/perf_hooks.html#perf_hooksmonitoreventloopdelayoptions) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_NODEJS_EVENTLOOP_DELAY_P99 = + 'nodejs.eventloop.delay.p99' as const; + +/** + * Event loop standard deviation delay. + * + * @note Value can be retrieved from value `histogram.stddev` of [`perf_hooks.monitorEventLoopDelay([options])`](https://nodejs.org/api/perf_hooks.html#perf_hooksmonitoreventloopdelayoptions) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_NODEJS_EVENTLOOP_DELAY_STDDEV = + 'nodejs.eventloop.delay.stddev' as const; + +/** + * Cumulative duration of time the event loop has been in each state. + * + * @note Value can be retrieved from [`performance.eventLoopUtilization([utilization1[, utilization2]])`](https://nodejs.org/api/perf_hooks.html#performanceeventlooputilizationutilization1-utilization2) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_NODEJS_EVENTLOOP_TIME = 'nodejs.eventloop.time' as const; + +/** + * Event loop utilization. + * + * @note The value range is [0.0, 1.0] and can be retrieved from [`performance.eventLoopUtilization([utilization1[, utilization2]])`](https://nodejs.org/api/perf_hooks.html#performanceeventlooputilizationutilization1-utilization2) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_NODEJS_EVENTLOOP_UTILIZATION = + 'nodejs.eventloop.utilization' as const; + +/** + * Garbage collection duration. + * + * @note The values can be retrieved from [`perf_hooks.PerformanceObserver(...).observe({ entryTypes: ['gc'] })`](https://nodejs.org/api/perf_hooks.html#performanceobserverobserveoptions) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_V8JS_GC_DURATION = 'v8js.gc.duration' as const; + +/** + * Total heap memory size pre-allocated. + * + * @note The value can be retrieved from value `space_size` of [`v8.getHeapSpaceStatistics()`](https://nodejs.org/api/v8.html#v8getheapspacestatistics) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_V8JS_MEMORY_HEAP_LIMIT = 'v8js.memory.heap.limit' as const; + +/** + * Heap Memory size allocated. + * + * @note The value can be retrieved from value `space_used_size` of [`v8.getHeapSpaceStatistics()`](https://nodejs.org/api/v8.html#v8getheapspacestatistics) + * + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const METRIC_V8JS_MEMORY_HEAP_USED = 'v8js.memory.heap.used' as const; + +/** + * Enum value "active" for attribute {@link ATTR_NODEJS_EVENTLOOP_STATE}. + * + * Active time. + * + * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const NODEJS_EVENTLOOP_STATE_VALUE_ACTIVE = 'active' as const; + +/** + * Enum value "idle" for attribute {@link ATTR_NODEJS_EVENTLOOP_STATE}. + * + * Idle time. + * + * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const NODEJS_EVENTLOOP_STATE_VALUE_IDLE = 'idle' as const; diff --git a/packages/instrumentation-runtime-node/src/types/ConventionalNamePrefix.ts b/packages/instrumentation-runtime-node/src/types/ConventionalNamePrefix.ts deleted file mode 100644 index 6b17a6e00d..0000000000 --- a/packages/instrumentation-runtime-node/src/types/ConventionalNamePrefix.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export enum ConventionalNamePrefix { - NodeJs = 'nodejs', - V8js = 'v8js', -} diff --git a/packages/instrumentation-runtime-node/test/event_loop_delay.test.ts b/packages/instrumentation-runtime-node/test/event_loop_delay.test.ts index d77bfbdcfe..4c8141294e 100644 --- a/packages/instrumentation-runtime-node/test/event_loop_delay.test.ts +++ b/packages/instrumentation-runtime-node/test/event_loop_delay.test.ts @@ -13,15 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +import * as assert from 'assert'; + import { MeterProvider, DataPointType } from '@opentelemetry/sdk-metrics'; import { RuntimeNodeInstrumentation } from '../src'; -import * as assert from 'assert'; import { TestMetricReader } from './testMetricsReader'; -import { metricNames } from '../src/metrics/eventLoopDelayCollector'; -import { ConventionalNamePrefix } from '../src/types/ConventionalNamePrefix'; -describe(`${ConventionalNamePrefix.NodeJs}.eventloop`, function () { +import * as semconv from '../src/semconv'; + +describe(`nodejs.eventloop.delay.*`, function () { let metricReader: TestMetricReader; let meterProvider: MeterProvider; @@ -32,8 +34,11 @@ describe(`${ConventionalNamePrefix.NodeJs}.eventloop`, function () { }); }); - for (const metricName in metricNames) { - it(`should write ${ConventionalNamePrefix.NodeJs}.${metricName} after monitoringPrecision`, async function () { + const metricNames = Object.keys(semconv) + .filter(k => k.startsWith('METRIC_NODEJS_EVENTLOOP_DELAY_')) + .map(k => (semconv as any)[k]); + for (const metricName of metricNames) { + it(`should write ${metricName} after monitoringPrecision`, async function () { // arrange const instrumentation = new RuntimeNodeInstrumentation({ monitoringPrecision: 10, @@ -52,15 +57,10 @@ describe(`${ConventionalNamePrefix.NodeJs}.eventloop`, function () { ); const scopeMetrics = resourceMetrics.scopeMetrics; const metric = scopeMetrics[0].metrics.find( - x => - x.descriptor.name === `${ConventionalNamePrefix.NodeJs}.${metricName}` + x => x.descriptor.name === metricName ); - assert.notEqual( - metric, - undefined, - `${ConventionalNamePrefix.NodeJs}.${metricName} not found` - ); + assert.notEqual(metric, undefined, `${metricName} not found`); assert.strictEqual( metric!.dataPointType, @@ -70,7 +70,7 @@ describe(`${ConventionalNamePrefix.NodeJs}.eventloop`, function () { assert.strictEqual( metric!.descriptor.name, - `${ConventionalNamePrefix.NodeJs}.${metricName}`, + metricName, 'descriptor.name' ); }); diff --git a/packages/instrumentation-runtime-node/test/event_loop_time.test.ts b/packages/instrumentation-runtime-node/test/event_loop_time.test.ts index 7ee96150f3..f8fe565354 100644 --- a/packages/instrumentation-runtime-node/test/event_loop_time.test.ts +++ b/packages/instrumentation-runtime-node/test/event_loop_time.test.ts @@ -13,17 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +import * as assert from 'assert'; + import { MeterProvider } from '@opentelemetry/sdk-metrics'; import { RuntimeNodeInstrumentation } from '../src'; -import * as assert from 'assert'; import { TestMetricReader } from './testMetricsReader'; -import { ConventionalNamePrefix } from '../src/types/ConventionalNamePrefix'; -import { ATTR_NODEJS_EVENT_LOOP_TIME } from '../src/metrics/eventLoopTimeCollector'; +import { METRIC_NODEJS_EVENTLOOP_TIME } from '../src/semconv'; const MEASUREMENT_INTERVAL = 10; -describe(`${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_TIME}`, function () { +describe('nodejs.eventloop.time', function () { let metricReader: TestMetricReader; let meterProvider: MeterProvider; @@ -52,7 +53,7 @@ describe(`${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_TIME}`, func assert.strictEqual(scopeMetrics.length, 0); }); - it(`should write ${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_TIME}`, async function () { + it(`should write 'nodejs.eventloop.time'`, async function () { // arrange const instrumentation = new RuntimeNodeInstrumentation({ monitoringPrecision: MEASUREMENT_INTERVAL, @@ -71,16 +72,14 @@ describe(`${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_TIME}`, func ); const scopeMetrics = resourceMetrics.scopeMetrics; const timeMetric = scopeMetrics[0].metrics.find( - x => - x.descriptor.name === - `${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_TIME}` + x => x.descriptor.name === METRIC_NODEJS_EVENTLOOP_TIME ); assert.notEqual(timeMetric, undefined, 'metric not found'); assert.strictEqual( timeMetric!.descriptor.name, - `${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_TIME}`, + METRIC_NODEJS_EVENTLOOP_TIME, 'descriptor.name' ); diff --git a/packages/instrumentation-runtime-node/test/event_loop_utilization.test.ts b/packages/instrumentation-runtime-node/test/event_loop_utilization.test.ts index 3200dd0392..899d9b31bb 100644 --- a/packages/instrumentation-runtime-node/test/event_loop_utilization.test.ts +++ b/packages/instrumentation-runtime-node/test/event_loop_utilization.test.ts @@ -13,17 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +import * as assert from 'assert'; + import { MeterProvider } from '@opentelemetry/sdk-metrics'; import { RuntimeNodeInstrumentation } from '../src'; -import * as assert from 'assert'; import { TestMetricReader } from './testMetricsReader'; -import { ConventionalNamePrefix } from '../src/types/ConventionalNamePrefix'; -import { ATTR_NODEJS_EVENT_LOOP_UTILIZATION } from '../src/metrics/eventLoopUtilizationCollector'; +import { METRIC_NODEJS_EVENTLOOP_UTILIZATION } from '../src/semconv'; const MEASUREMENT_INTERVAL = 10; -describe(`${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_UTILIZATION}`, function () { +describe('nodejs.eventloop.utilization', function () { let metricReader: TestMetricReader; let meterProvider: MeterProvider; @@ -52,7 +53,7 @@ describe(`${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_UTILIZATION} assert.strictEqual(scopeMetrics.length, 0); }); - it(`should write ${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_UTILIZATION}`, async function () { + it(`should write nodejs.eventloop.utilization`, async function () { // arrange const instrumentation = new RuntimeNodeInstrumentation({ monitoringPrecision: MEASUREMENT_INTERVAL, @@ -71,16 +72,14 @@ describe(`${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_UTILIZATION} ); const scopeMetrics = resourceMetrics.scopeMetrics; const utilizationMetric = scopeMetrics[0].metrics.find( - x => - x.descriptor.name === - `${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_UTILIZATION}` + x => x.descriptor.name === METRIC_NODEJS_EVENTLOOP_UTILIZATION ); assert.notEqual(utilizationMetric, undefined, 'metric not found'); assert.strictEqual( utilizationMetric!.descriptor.name, - `${ConventionalNamePrefix.NodeJs}.${ATTR_NODEJS_EVENT_LOOP_UTILIZATION}`, + METRIC_NODEJS_EVENTLOOP_UTILIZATION, 'descriptor.name' ); diff --git a/packages/instrumentation-runtime-node/test/heap_space_and_used.test.ts b/packages/instrumentation-runtime-node/test/heap_space_and_used.test.ts index 43aae14344..e0a299de52 100644 --- a/packages/instrumentation-runtime-node/test/heap_space_and_used.test.ts +++ b/packages/instrumentation-runtime-node/test/heap_space_and_used.test.ts @@ -13,19 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +import * as assert from 'assert'; + import { DataPointType, MeterProvider } from '@opentelemetry/sdk-metrics'; +import { GaugeMetricData } from '@opentelemetry/sdk-metrics/build/src/export/MetricData'; import { RuntimeNodeInstrumentation } from '../src'; -import * as assert from 'assert'; import { TestMetricReader } from './testMetricsReader'; -import { metricNames } from '../src/metrics/heapSpacesSizeAndUsedCollector'; -import { ConventionalNamePrefix } from '../src/types/ConventionalNamePrefix'; -import { ATTR_V8JS_HEAP_SPACE_NAME } from '../src/consts/attributes'; -import { GaugeMetricData } from '@opentelemetry/sdk-metrics/build/src/export/MetricData'; +import { + ATTR_V8JS_HEAP_SPACE_NAME, + METRIC_V8JS_MEMORY_HEAP_LIMIT, + METRIC_V8JS_MEMORY_HEAP_USED, +} from '../src/semconv'; const MEASUREMENT_INTERVAL = 10; -describe('nodejs.heap_space', function () { +describe('v8js.memory.heap.*', function () { let metricReader: TestMetricReader; let meterProvider: MeterProvider; @@ -36,8 +40,16 @@ describe('nodejs.heap_space', function () { }); }); - for (const metricName in metricNames) { - it(`should write ${ConventionalNamePrefix.V8js}.${metricName} after monitoringPrecision`, async function () { + const metricNames = [ + METRIC_V8JS_MEMORY_HEAP_LIMIT, + METRIC_V8JS_MEMORY_HEAP_USED, + // TODO: fix to use METRIC_V8JS_HEAP_SPACE_AVAILABLE_SIZE (breaking change) + 'v8js.memory.heap.space.available_size', + // TODO: fix to use METRIC_V8JS_HEAP_SPACE_PHYSICAL_SIZE (breaking change) + 'v8js.memory.heap.space.physical_size', + ]; + for (const metricName of metricNames) { + it(`should write ${metricName} after monitoringPrecision`, async function () { // arrange const instrumentation = new RuntimeNodeInstrumentation({ monitoringPrecision: MEASUREMENT_INTERVAL, @@ -58,15 +70,10 @@ describe('nodejs.heap_space', function () { ); const scopeMetrics = resourceMetrics.scopeMetrics; const metric = scopeMetrics[0].metrics.find( - x => - x.descriptor.name === `${ConventionalNamePrefix.V8js}.${metricName}` + x => x.descriptor.name === metricName ); - assert.notEqual( - metric, - undefined, - `${ConventionalNamePrefix.V8js}.${metricName} not found` - ); + assert.notEqual(metric, undefined, `${metricName} not found`); assert.strictEqual( metric!.dataPointType, @@ -76,18 +83,20 @@ describe('nodejs.heap_space', function () { assert.strictEqual( metric!.descriptor.name, - `${ConventionalNamePrefix.V8js}.${metricName}`, + metricName, 'descriptor.name' ); }); + // Hardcoding a minimal set of space names is fine, but v8 does not promise + // these are stable. See https://github.com/open-telemetry/semantic-conventions/issues/2832 for (const space of [ 'new_space', 'old_space', 'code_space', 'large_object_space', ]) { - it(`should write ${ConventionalNamePrefix.V8js}.${metricName} ${space} attribute`, async function () { + it(`should write ${metricName} ${space} attribute`, async function () { // arrange const instrumentation = new RuntimeNodeInstrumentation({ monitoringPrecision: MEASUREMENT_INTERVAL, @@ -110,23 +119,19 @@ describe('nodejs.heap_space', function () { const scopeMetrics = resourceMetrics.scopeMetrics; let metric: GaugeMetricData | undefined = undefined; const foundMetric = scopeMetrics[0].metrics.find( - x => - x.descriptor.name === `${ConventionalNamePrefix.V8js}.${metricName}` + x => x.descriptor.name === metricName ); if (foundMetric?.dataPointType === DataPointType.GAUGE) { metric = foundMetric; } const spaceAttribute = metric?.dataPoints.find( - x => - x.attributes[ - `${ConventionalNamePrefix.V8js}.${ATTR_V8JS_HEAP_SPACE_NAME}` - ] === space + x => x.attributes[ATTR_V8JS_HEAP_SPACE_NAME] === space ); assert.notEqual( spaceAttribute, undefined, - `${ConventionalNamePrefix.V8js}.${metricName} space: ${space} not found` + `${metricName} space "${space}" not found` ); }); } From 096ead1ec2f6cddd0fcb7327b0e59649bae586f0 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Mon, 29 Sep 2025 22:13:14 -0700 Subject: [PATCH 2/4] lint:fix --- .../src/metrics/gcCollector.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts b/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts index e376dd70df..9803023028 100644 --- a/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts +++ b/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts @@ -48,10 +48,9 @@ export class GCCollector extends BaseCollector { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore const kind = entry.detail ? kinds[entry.detail.kind] : kinds[entry.kind]; - this._gcDurationByKindHistogram?.record( - entry.duration / 1000, - { [ATTR_V8JS_GC_TYPE]: kind } - ); + this._gcDurationByKindHistogram?.record(entry.duration / 1000, { + [ATTR_V8JS_GC_TYPE]: kind, + }); }); } From e2cb3193b9c64b017dd9acb4dfd9c6344e19b3dc Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Wed, 1 Oct 2025 14:49:39 -0700 Subject: [PATCH 3/4] style: Remove blank lines within the `import ...`s block Per review feedback. Co-authored-by: Marylia Gutierrez --- .../src/metrics/eventLoopTimeCollector.ts | 2 -- .../src/metrics/eventLoopUtilizationCollector.ts | 2 -- .../instrumentation-runtime-node/src/metrics/gcCollector.ts | 2 -- .../instrumentation-runtime-node/test/event_loop_delay.test.ts | 3 --- .../instrumentation-runtime-node/test/event_loop_time.test.ts | 2 -- .../test/event_loop_utilization.test.ts | 2 -- .../test/heap_space_and_used.test.ts | 2 -- 7 files changed, 15 deletions(-) diff --git a/packages/instrumentation-runtime-node/src/metrics/eventLoopTimeCollector.ts b/packages/instrumentation-runtime-node/src/metrics/eventLoopTimeCollector.ts index d5b86272d1..af3a77b10b 100644 --- a/packages/instrumentation-runtime-node/src/metrics/eventLoopTimeCollector.ts +++ b/packages/instrumentation-runtime-node/src/metrics/eventLoopTimeCollector.ts @@ -15,9 +15,7 @@ */ import { EventLoopUtilization, performance } from 'node:perf_hooks'; - import { Meter } from '@opentelemetry/api'; - import { BaseCollector } from './baseCollector'; import { METRIC_NODEJS_EVENTLOOP_TIME, diff --git a/packages/instrumentation-runtime-node/src/metrics/eventLoopUtilizationCollector.ts b/packages/instrumentation-runtime-node/src/metrics/eventLoopUtilizationCollector.ts index 0be3c8f016..2cf96c03ca 100644 --- a/packages/instrumentation-runtime-node/src/metrics/eventLoopUtilizationCollector.ts +++ b/packages/instrumentation-runtime-node/src/metrics/eventLoopUtilizationCollector.ts @@ -15,9 +15,7 @@ */ import { EventLoopUtilization, performance } from 'node:perf_hooks'; - import { Meter } from '@opentelemetry/api'; - import { BaseCollector } from './baseCollector'; import { METRIC_NODEJS_EVENTLOOP_UTILIZATION } from '../semconv'; diff --git a/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts b/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts index 9803023028..790b641cda 100644 --- a/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts +++ b/packages/instrumentation-runtime-node/src/metrics/gcCollector.ts @@ -16,9 +16,7 @@ import * as perf_hooks from 'node:perf_hooks'; import { PerformanceObserver } from 'node:perf_hooks'; - import { Meter } from '@opentelemetry/api'; - import { RuntimeNodeInstrumentationConfig } from '../types'; import { Histogram, ValueType } from '@opentelemetry/api'; import { BaseCollector } from './baseCollector'; diff --git a/packages/instrumentation-runtime-node/test/event_loop_delay.test.ts b/packages/instrumentation-runtime-node/test/event_loop_delay.test.ts index 4c8141294e..ca8e3d9f8a 100644 --- a/packages/instrumentation-runtime-node/test/event_loop_delay.test.ts +++ b/packages/instrumentation-runtime-node/test/event_loop_delay.test.ts @@ -15,12 +15,9 @@ */ import * as assert from 'assert'; - import { MeterProvider, DataPointType } from '@opentelemetry/sdk-metrics'; - import { RuntimeNodeInstrumentation } from '../src'; import { TestMetricReader } from './testMetricsReader'; - import * as semconv from '../src/semconv'; describe(`nodejs.eventloop.delay.*`, function () { diff --git a/packages/instrumentation-runtime-node/test/event_loop_time.test.ts b/packages/instrumentation-runtime-node/test/event_loop_time.test.ts index f8fe565354..ab8a3d4f72 100644 --- a/packages/instrumentation-runtime-node/test/event_loop_time.test.ts +++ b/packages/instrumentation-runtime-node/test/event_loop_time.test.ts @@ -15,9 +15,7 @@ */ import * as assert from 'assert'; - import { MeterProvider } from '@opentelemetry/sdk-metrics'; - import { RuntimeNodeInstrumentation } from '../src'; import { TestMetricReader } from './testMetricsReader'; import { METRIC_NODEJS_EVENTLOOP_TIME } from '../src/semconv'; diff --git a/packages/instrumentation-runtime-node/test/event_loop_utilization.test.ts b/packages/instrumentation-runtime-node/test/event_loop_utilization.test.ts index 899d9b31bb..93940b6136 100644 --- a/packages/instrumentation-runtime-node/test/event_loop_utilization.test.ts +++ b/packages/instrumentation-runtime-node/test/event_loop_utilization.test.ts @@ -15,9 +15,7 @@ */ import * as assert from 'assert'; - import { MeterProvider } from '@opentelemetry/sdk-metrics'; - import { RuntimeNodeInstrumentation } from '../src'; import { TestMetricReader } from './testMetricsReader'; import { METRIC_NODEJS_EVENTLOOP_UTILIZATION } from '../src/semconv'; diff --git a/packages/instrumentation-runtime-node/test/heap_space_and_used.test.ts b/packages/instrumentation-runtime-node/test/heap_space_and_used.test.ts index e0a299de52..26acf50675 100644 --- a/packages/instrumentation-runtime-node/test/heap_space_and_used.test.ts +++ b/packages/instrumentation-runtime-node/test/heap_space_and_used.test.ts @@ -15,10 +15,8 @@ */ import * as assert from 'assert'; - import { DataPointType, MeterProvider } from '@opentelemetry/sdk-metrics'; import { GaugeMetricData } from '@opentelemetry/sdk-metrics/build/src/export/MetricData'; - import { RuntimeNodeInstrumentation } from '../src'; import { TestMetricReader } from './testMetricsReader'; import { From 1cb4d0a905d15710017180530e16fd3be345d0ea Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Thu, 2 Oct 2025 10:33:14 -0700 Subject: [PATCH 4/4] Update the TODO comments for expected semconv fix: https://github.com/open-telemetry/semantic-conventions/pull/2856 --- .../src/metrics/heapSpacesSizeAndUsedCollector.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/instrumentation-runtime-node/src/metrics/heapSpacesSizeAndUsedCollector.ts b/packages/instrumentation-runtime-node/src/metrics/heapSpacesSizeAndUsedCollector.ts index f0d3d69270..dcf9044985 100644 --- a/packages/instrumentation-runtime-node/src/metrics/heapSpacesSizeAndUsedCollector.ts +++ b/packages/instrumentation-runtime-node/src/metrics/heapSpacesSizeAndUsedCollector.ts @@ -43,7 +43,7 @@ export class HeapSpacesSizeAndUsedCollector extends BaseCollector { } ); const heapSpaceAvailable = meter.createObservableGauge( - // TODO: fix to use METRIC_V8JS_HEAP_SPACE_AVAILABLE_SIZE (breaking change) + // TODO: Use METRIC_V8JS_MEMORY_HEAP_SPACE_AVAILABLE_SIZE when available in semconv v1.38.0 'v8js.memory.heap.space.available_size', { description: 'Heap space available size.', @@ -51,7 +51,7 @@ export class HeapSpacesSizeAndUsedCollector extends BaseCollector { } ); const heapSpacePhysical = meter.createObservableGauge( - // TODO: fix to use METRIC_V8JS_HEAP_SPACE_PHYSICAL_SIZE (breaking change) + // TODO: Use METRIC_V8JS_MEMORY_HEAP_SPACE_PHYSICAL_SIZE when available in semconv v1.38.0 'v8js.memory.heap.space.physical_size', { description: 'Committed size of a heap space.',