Skip to content

Commit

Permalink
add nodejs.eventloop.time metric (#1259)
Browse files Browse the repository at this point in the history
Co-authored-by: Liudmila Molkova <[email protected]>
  • Loading branch information
2 people authored and ezimuel committed Aug 20, 2024
1 parent ae0e066 commit 03b67bf
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .chloggen/nodejs-runtime-utilization.yaml
Original file line number Diff line number Diff line change
@@ -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]
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ body:
- area:log
- area:messaging
- area:network
- area:nodejs
- area:oci
- area:opentracing
- area:os
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/change_proposal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ body:
- area:log
- area:messaging
- area:network
- area:nodejs
- area:oci
- area:opentracing
- area:os
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/new-conventions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ body:
- area:log
- area:messaging
- area:network
- area:nodejs
- area:oci
- area:opentracing
- area:os
Expand Down
1 change: 1 addition & 0 deletions docs/attributes-registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 22 additions & 0 deletions docs/attributes-registry/nodejs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--- Hugo front matter used to generate the website version of this page:
--->

<!-- NOTE: THIS FILE IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/attribute_namespace.md.j2 -->

# 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) |
53 changes: 52 additions & 1 deletion docs/runtime/nodejs-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<!-- tocstop -->

Expand Down Expand Up @@ -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)



Expand All @@ -333,6 +334,56 @@ This metric is [recommended][MetricRecommended].
<!-- markdownlint-disable -->


<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

### Metric: `nodejs.eventloop.time`

This metric is [recommended][MetricRecommended].

<!-- semconv metric.nodejs.eventloop.time(metric_table) -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

| 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)



<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

<!-- semconv metric.nodejs.eventloop.time(full) -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->

| 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) |



<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
Expand Down
16 changes: 15 additions & 1 deletion model/metrics/nodejs-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
19 changes: 19 additions & 0 deletions model/registry/nodejs.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 03b67bf

Please sign in to comment.