From b6793e2df75446a9f1c3e459deccc801fa512342 Mon Sep 17 00:00:00 2001 From: Marylia Gutierrez Date: Wed, 14 Aug 2024 20:38:41 -0400 Subject: [PATCH] add `nodejs.eventloop.time` metric (#1259) Co-authored-by: Liudmila Molkova --- .chloggen/nodejs-runtime-utilization.yaml | 17 +++++++ .github/ISSUE_TEMPLATE/bug_report.yaml | 1 + .github/ISSUE_TEMPLATE/change_proposal.yaml | 1 + .github/ISSUE_TEMPLATE/new-conventions.yaml | 1 + docs/attributes-registry/README.md | 1 + docs/attributes-registry/nodejs.md | 22 +++++++++ docs/runtime/nodejs-metrics.md | 53 ++++++++++++++++++++- model/metrics/nodejs-metrics.yaml | 16 ++++++- model/registry/nodejs.yaml | 19 ++++++++ 9 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 .chloggen/nodejs-runtime-utilization.yaml create mode 100644 docs/attributes-registry/nodejs.md create mode 100644 model/registry/nodejs.yaml diff --git a/.chloggen/nodejs-runtime-utilization.yaml b/.chloggen/nodejs-runtime-utilization.yaml new file mode 100644 index 0000000000..a0a2272770 --- /dev/null +++ b/.chloggen/nodejs-runtime-utilization.yaml @@ -0,0 +1,17 @@ +# Use this changelog template to create an entry for release notes. +# +# If your change doesn't affect end users you should instead start +# your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db) +component: nodejs + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Adding `nodejs.eventloop.time` metric to Node.js runtime metrics. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +# The values here must be integers. +issues: [1259] diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 8a7e8aee67..ef601a5b8e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -59,6 +59,7 @@ body: - area:log - area:messaging - area:network + - area:nodejs - area:oci - area:opentracing - area:os diff --git a/.github/ISSUE_TEMPLATE/change_proposal.yaml b/.github/ISSUE_TEMPLATE/change_proposal.yaml index d924b6fe58..d2a5bca98c 100644 --- a/.github/ISSUE_TEMPLATE/change_proposal.yaml +++ b/.github/ISSUE_TEMPLATE/change_proposal.yaml @@ -51,6 +51,7 @@ body: - area:log - area:messaging - area:network + - area:nodejs - area:oci - area:opentracing - area:os diff --git a/.github/ISSUE_TEMPLATE/new-conventions.yaml b/.github/ISSUE_TEMPLATE/new-conventions.yaml index ca0f864b07..610edd03cb 100644 --- a/.github/ISSUE_TEMPLATE/new-conventions.yaml +++ b/.github/ISSUE_TEMPLATE/new-conventions.yaml @@ -60,6 +60,7 @@ body: - area:log - area:messaging - area:network + - area:nodejs - area:oci - area:opentracing - area:os diff --git a/docs/attributes-registry/README.md b/docs/attributes-registry/README.md index f4a53171a0..119a6c1437 100644 --- a/docs/attributes-registry/README.md +++ b/docs/attributes-registry/README.md @@ -72,6 +72,7 @@ Currently, the following namespaces exist: - [Log](log.md) - [Messaging](messaging.md) - [Network](network.md) +- [NodeJS](nodejs.md) - [OCI](oci.md) - [OpenTracing](opentracing.md) - [OS](os.md) diff --git a/docs/attributes-registry/nodejs.md b/docs/attributes-registry/nodejs.md new file mode 100644 index 0000000000..f00fa220bf --- /dev/null +++ b/docs/attributes-registry/nodejs.md @@ -0,0 +1,22 @@ + + + + + +# NodeJS + +## Node.js Attributes + +Describes Node.js related attributes. + +| Attribute | Type | Description | Examples | Stability | +| ------------------------ | ------ | ----------------------------- | ---------------- | ---------------------------------------------------------------- | +| `nodejs.eventloop.state` | string | The state of event loop time. | `active`; `idle` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +`nodejs.eventloop.state` 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. + +| Value | Description | Stability | +| -------- | ------------ | ---------------------------------------------------------------- | +| `active` | Active time. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `idle` | Idle time. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | diff --git a/docs/runtime/nodejs-metrics.md b/docs/runtime/nodejs-metrics.md index 5d01a28341..f53ce11373 100644 --- a/docs/runtime/nodejs-metrics.md +++ b/docs/runtime/nodejs-metrics.md @@ -21,6 +21,7 @@ This document describes semantic conventions for Node.js Runtime metrics in Open - [Metric: `nodejs.eventloop.delay.p90`](#metric-nodejseventloopdelayp90) - [Metric: `nodejs.eventloop.delay.p99`](#metric-nodejseventloopdelayp99) - [Metric: `nodejs.eventloop.utilization`](#metric-nodejseventlooputilization) + - [Metric: `nodejs.eventloop.time`](#metric-nodejseventlooptime) @@ -316,7 +317,7 @@ This metric is [recommended][MetricRecommended]. | `nodejs.eventloop.utilization` | Gauge | `1` | Event loop utilization. [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -**[1]:** The value range is [0.0,1.0] and can be retrieved from value [`performance.eventLoopUtilization([utilization1[, utilization2]])`](https://nodejs.org/api/perf_hooks.html#performanceeventlooputilizationutilization1-utilization2) +**[1]:** 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) @@ -333,6 +334,56 @@ This metric is [recommended][MetricRecommended]. + + + + + +### Metric: `nodejs.eventloop.time` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| Name | Instrument Type | Unit (UCUM) | Description | Stability | +| -------- | --------------- | ----------- | -------------- | --------- | +| `nodejs.eventloop.time` | Counter | `s` | Cumulative duration of time the event loop has been in each state. [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + + +**[1]:** Value can be retrieved from [`performance.eventLoopUtilization([utilization1[, utilization2]])`](https://nodejs.org/api/perf_hooks.html#performanceeventlooputilizationutilization1-utilization2) + + + + + + + + + + + + + + + +| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | +|---|---|---|---|---|---| +| [`nodejs.eventloop.state`](/docs/attributes-registry/nodejs.md) | string | The state of event loop time. | `active`; `idle` | `Required` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +`nodejs.eventloop.state` 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. + +| Value | Description | Stability | +|---|---|---| +| `active` | Active time. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `idle` | Idle time. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + + + diff --git a/model/metrics/nodejs-metrics.yaml b/model/metrics/nodejs-metrics.yaml index 9def4fa143..3c10b18fc3 100644 --- a/model/metrics/nodejs-metrics.yaml +++ b/model/metrics/nodejs-metrics.yaml @@ -77,5 +77,19 @@ groups: unit: "1" stability: experimental note: > - The value range is [0.0,1.0] and can be retrieved from value + 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) + + - id: metric.nodejs.eventloop.time + type: metric + metric_name: nodejs.eventloop.time + brief: "Cumulative duration of time the event loop has been in each state." + instrument: counter + unit: "s" + stability: experimental + attributes: + - ref: nodejs.eventloop.state + requirement_level: required + note: > + Value can be retrieved from [`performance.eventLoopUtilization([utilization1[, utilization2]])`](https://nodejs.org/api/perf_hooks.html#performanceeventlooputilizationutilization1-utilization2) diff --git a/model/registry/nodejs.yaml b/model/registry/nodejs.yaml new file mode 100644 index 0000000000..2f5ded1bdc --- /dev/null +++ b/model/registry/nodejs.yaml @@ -0,0 +1,19 @@ +groups: + - id: registry.nodejs + type: attribute_group + brief: Describes Node.js related attributes. + display_name: Node.js Attributes + attributes: + - id: nodejs.eventloop.state + stability: experimental + brief: The state of event loop time. + type: + members: + - id: active + value: 'active' + brief: 'Active time.' + stability: experimental + - id: idle + value: 'idle' + brief: 'Idle time.' + stability: experimental