You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2026/08/07 16:00:26 UTC
(skywalking) branch master updated: feat(oap): twelve Node.js runtime meters + pin apache agent #143 (#13970)
This is an automated email from the ASF dual-hosted git repository.
wu-sheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new a2498aad76 feat(oap): twelve Node.js runtime meters + pin apache agent #143 (#13970)
a2498aad76 is described below
commit a2498aad765c58e0864fef74771bb437059c6ec4
Author: songzhendong <xi...@qq.com>
AuthorDate: Sat Aug 8 00:00:19 2026 +0800
feat(oap): twelve Node.js runtime meters + pin apache agent #143 (#13970)
---
docs/en/changes/changes.md | 2 +-
docs/en/setup/backend/dashboards-nodejs-runtime.md | 30 ++++----
.../nodejs-runtime.data.yaml | 80 ++++++++++++++++++++++
.../meter-analyzer-config/nodejs-runtime.yaml | 12 ++++
test/e2e-v2/cases/nodejs/Dockerfile.nodejs | 3 +-
test/e2e-v2/cases/nodejs/docker-compose.yml | 2 +
test/e2e-v2/cases/nodejs/e2e.yaml | 12 ++++
test/e2e-v2/script/env | 3 +-
8 files changed, 128 insertions(+), 16 deletions(-)
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 0c51ebd786..bd571522c2 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -261,7 +261,7 @@
- The internal `MeterConfig` / `MeterConfigs` model is removed in favour of the shared one.
- **Behaviour change:** an entry in `meterAnalyzerActiveFiles` (`SW_METER_ANALYZER_ACTIVE_FILES`) with no matching rule file now fails OAP startup instead of being silently ignored, matching how `otel-rules` has always behaved.
* Support Elasticsearch 9.x as storage.
-* Add Node.js runtime metrics via the Node.js agent **`MeterReportService`** pipeline (`meter_instance_nodejs_*`, 1s collect/report). OAP analyzes raw meters through `nodejs-runtime.yaml`. Node.js E2E asserts six `meter_instance_nodejs_*` metrics (`test/e2e-v2/cases/nodejs/e2e.yaml`).
+* Add Node.js runtime metrics via the Node.js agent **`MeterReportService`** pipeline (`meter_instance_nodejs_*`, default 20s sample/report). OAP analyzes raw meters through `nodejs-runtime.yaml`. Node.js E2E asserts twelve `meter_instance_nodejs_*` metrics (`test/e2e-v2/cases/nodejs/e2e.yaml`).
* Add PHP runtime PHM meter analyzer (`php-runtime.yaml`) for SkyWalking PHP agent process
metrics (CPU, memory, virtual memory, thread count, open file descriptors sampled from
`/proc` on Linux). Registers six `meter_instance_php_*` metrics on the General Service
diff --git a/docs/en/setup/backend/dashboards-nodejs-runtime.md b/docs/en/setup/backend/dashboards-nodejs-runtime.md
index ae91a8a15f..c022389df2 100644
--- a/docs/en/setup/backend/dashboards-nodejs-runtime.md
+++ b/docs/en/setup/backend/dashboards-nodejs-runtime.md
@@ -7,16 +7,16 @@ The SkyWalking Node.js agent reports **runtime metrics** (process memory and CPU
## Platform support
Runtime meters are collected on **Linux, macOS, and Windows** via Node.js built-in APIs
-(`process.memoryUsage()`, `process.cpuUsage()`, `v8.getHeapStatistics()`).
+(`process.memoryUsage()`, `process.cpuUsage()`, `process.uptime()`, `v8.getHeapStatistics()`, `v8.getHeapSpaceStatistics()`).
## Data flow
-1. On each collect interval (default **1 second**), the agent samples Node.js runtime APIs.
-2. Samples are mapped into `MeterData` protobuf messages and buffered.
-3. On each report interval (default **1 second**), buffered meters are sent to OAP over gRPC port **11800**
- via `MeterReportService.collect` (independent from trace export on the same address).
-4. OAP applies MAL rules in `nodejs-runtime.yaml` and exposes **`meter_instance_nodejs_*`** metrics.
-5. Horizon UI renders widgets on **General Service → Instance → Dashboard** when the corresponding
+1. On each report interval (default **20 seconds**), the agent samples Node.js runtime APIs
+ and maps them into `MeterData` protobuf messages.
+2. The latest gauge snapshot is sent to OAP over gRPC port **11800** via `MeterReportService.collect`
+ (independent from trace export on the same address).
+3. OAP applies MAL rules in `nodejs-runtime.yaml` and exposes **`meter_instance_nodejs_*`** metrics.
+4. Horizon UI renders widgets on **General Service → Instance → Dashboard** when the corresponding
`meter_instance_nodejs_*` metrics exist.
## Agent setup
@@ -26,11 +26,9 @@ Runtime metric reporting is **on by default**. Relevant environment variables:
| Variable | Description | Default |
| :--- | :--- | :--- |
| `SW_AGENT_NODEJS_RUNTIME_METRICS_REPORTER_ACTIVE` | Master switch for runtime metric export | `true` |
-| `SW_AGENT_NODEJS_RUNTIME_METRICS_COLLECT_PERIOD` | Sample interval (ms) | `1000` |
-| `SW_AGENT_NODEJS_RUNTIME_METRICS_REPORT_PERIOD` | Report interval (ms) | `1000` |
-| `SW_AGENT_NODEJS_RUNTIME_METRICS_BUFFER_SIZE` | Max buffered samples before dropping oldest | `600` |
+| `SW_AGENT_NODEJS_RUNTIME_METRICS_REPORT_PERIOD` | Sample + report interval in milliseconds | `20000` |
-Deprecated aliases `SW_AGENT_RUNTIME_METRICS_*`, `SW_AGENT_NVM_METRICS_*`, and `SW_AGENT_NVM_JVM_*` are still accepted.
+Deprecated aliases `SW_AGENT_RUNTIME_METRICS_*` / `SW_AGENT_NVM_*` for reporter active and report period are still accepted.
See the [Node.js agent README](https://github.com/apache/skywalking-nodejs/blob/master/README.md#nodejs-runtime-metrics)
for startup examples and the full field mapping from Node.js APIs to meter names.
@@ -53,16 +51,22 @@ Widgets appear only when runtime data is present (`visibleWhen` checks each `met
## Runtime metrics
-The agent reports raw meter names; OAP prefixes them with `meter_` when exposing queryable metrics:
+The agent reports twelve raw meter names; OAP prefixes them with `meter_` when exposing queryable metrics:
| Unit | Agent meter name | OAP / UI metric name | Description | Data Source |
| :--- | :--- | :--- | :--- | :--- |
-| % | `instance_nodejs_process_cpu` | `meter_instance_nodejs_process_cpu` | Process CPU (user + system) over collect interval | SkyWalking Node.js Agent |
+| % | `instance_nodejs_process_cpu` | `meter_instance_nodejs_process_cpu` | Process CPU (user + system) over the report interval | SkyWalking Node.js Agent |
| bytes | `instance_nodejs_heap_used` | `meter_instance_nodejs_heap_used` | V8 heap used | SkyWalking Node.js Agent |
| bytes | `instance_nodejs_heap_total` | `meter_instance_nodejs_heap_total` | V8 heap total | SkyWalking Node.js Agent |
| bytes | `instance_nodejs_heap_limit` | `meter_instance_nodejs_heap_limit` | V8 max heap size | SkyWalking Node.js Agent |
| bytes | `instance_nodejs_rss` | `meter_instance_nodejs_rss` | Resident set size | SkyWalking Node.js Agent |
| bytes | `instance_nodejs_external_memory` | `meter_instance_nodejs_external_memory` | External memory | SkyWalking Node.js Agent |
+| bytes | `instance_nodejs_array_buffers` | `meter_instance_nodejs_array_buffers` | ArrayBuffer / SharedArrayBuffer memory | SkyWalking Node.js Agent |
+| s | `instance_nodejs_uptime` | `meter_instance_nodejs_uptime` | Process uptime | SkyWalking Node.js Agent |
+| bytes | `instance_nodejs_peak_malloced_memory` | `meter_instance_nodejs_peak_malloced_memory` | Peak V8 malloced memory | SkyWalking Node.js Agent |
+| bytes | `instance_nodejs_malloced_memory` | `meter_instance_nodejs_malloced_memory` | Current V8 malloced memory | SkyWalking Node.js Agent |
+| bytes | `instance_nodejs_old_space_used` | `meter_instance_nodejs_old_space_used` | V8 old generation heap used | SkyWalking Node.js Agent |
+| bytes | `instance_nodejs_new_space_used` | `meter_instance_nodejs_new_space_used` | V8 new generation heap used | SkyWalking Node.js Agent |
## Customizations
diff --git a/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-meter-analyzer-config/nodejs-runtime.data.yaml b/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-meter-analyzer-config/nodejs-runtime.data.yaml
index 098012cc62..6f37f37cfc 100644
--- a/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-meter-analyzer-config/nodejs-runtime.data.yaml
+++ b/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-meter-analyzer-config/nodejs-runtime.data.yaml
@@ -39,6 +39,31 @@ input:
- labels:
instance: test-instance
value: 65536.0
+
+ instance_nodejs_array_buffers:
+ - labels:
+ instance: test-instance
+ value: 8192.0
+ instance_nodejs_uptime:
+ - labels:
+ instance: test-instance
+ value: 3600.0
+ instance_nodejs_peak_malloced_memory:
+ - labels:
+ instance: test-instance
+ value: 131072.0
+ instance_nodejs_malloced_memory:
+ - labels:
+ instance: test-instance
+ value: 98304.0
+ instance_nodejs_old_space_used:
+ - labels:
+ instance: test-instance
+ value: 524288.0
+ instance_nodejs_new_space_used:
+ - labels:
+ instance: test-instance
+ value: 262144.0
expected:
meter_instance_nodejs_process_cpu:
entities:
@@ -94,3 +119,58 @@ expected:
- labels:
instance: test-instance
value: 65536.0
+
+ meter_instance_nodejs_array_buffers:
+ entities:
+ - scope: SERVICE_INSTANCE
+ instance: test-instance
+ layer: GENERAL
+ samples:
+ - labels:
+ instance: test-instance
+ value: 8192.0
+ meter_instance_nodejs_uptime:
+ entities:
+ - scope: SERVICE_INSTANCE
+ instance: test-instance
+ layer: GENERAL
+ samples:
+ - labels:
+ instance: test-instance
+ value: 3600.0
+ meter_instance_nodejs_peak_malloced_memory:
+ entities:
+ - scope: SERVICE_INSTANCE
+ instance: test-instance
+ layer: GENERAL
+ samples:
+ - labels:
+ instance: test-instance
+ value: 131072.0
+ meter_instance_nodejs_malloced_memory:
+ entities:
+ - scope: SERVICE_INSTANCE
+ instance: test-instance
+ layer: GENERAL
+ samples:
+ - labels:
+ instance: test-instance
+ value: 98304.0
+ meter_instance_nodejs_old_space_used:
+ entities:
+ - scope: SERVICE_INSTANCE
+ instance: test-instance
+ layer: GENERAL
+ samples:
+ - labels:
+ instance: test-instance
+ value: 524288.0
+ meter_instance_nodejs_new_space_used:
+ entities:
+ - scope: SERVICE_INSTANCE
+ instance: test-instance
+ layer: GENERAL
+ samples:
+ - labels:
+ instance: test-instance
+ value: 262144.0
diff --git a/oap-server/server-starter/src/main/resources/meter-analyzer-config/nodejs-runtime.yaml b/oap-server/server-starter/src/main/resources/meter-analyzer-config/nodejs-runtime.yaml
index e1f90a2fda..0502c861b9 100644
--- a/oap-server/server-starter/src/main/resources/meter-analyzer-config/nodejs-runtime.yaml
+++ b/oap-server/server-starter/src/main/resources/meter-analyzer-config/nodejs-runtime.yaml
@@ -30,3 +30,15 @@ metricsRules:
exp: instance_nodejs_rss
- name: instance_nodejs_external_memory
exp: instance_nodejs_external_memory
+ - name: instance_nodejs_array_buffers
+ exp: instance_nodejs_array_buffers
+ - name: instance_nodejs_uptime
+ exp: instance_nodejs_uptime
+ - name: instance_nodejs_peak_malloced_memory
+ exp: instance_nodejs_peak_malloced_memory
+ - name: instance_nodejs_malloced_memory
+ exp: instance_nodejs_malloced_memory
+ - name: instance_nodejs_old_space_used
+ exp: instance_nodejs_old_space_used
+ - name: instance_nodejs_new_space_used
+ exp: instance_nodejs_new_space_used
diff --git a/test/e2e-v2/cases/nodejs/Dockerfile.nodejs b/test/e2e-v2/cases/nodejs/Dockerfile.nodejs
index 3d28865d88..99edb8c311 100644
--- a/test/e2e-v2/cases/nodejs/Dockerfile.nodejs
+++ b/test/e2e-v2/cases/nodejs/Dockerfile.nodejs
@@ -15,13 +15,14 @@
FROM node:20
+ARG SW_AGENT_NODEJS_REPO=https://github.com/apache/skywalking-nodejs.git
ARG SW_AGENT_NODEJS_COMMIT
WORKDIR /app
EXPOSE 5050 5051
-RUN git clone https://github.com/apache/skywalking-nodejs.git $(pwd)
+RUN git clone ${SW_AGENT_NODEJS_REPO} $(pwd)
RUN git reset --hard ${SW_AGENT_NODEJS_COMMIT} && git submodule update --init
diff --git a/test/e2e-v2/cases/nodejs/docker-compose.yml b/test/e2e-v2/cases/nodejs/docker-compose.yml
index bb3c379be2..a374f38558 100644
--- a/test/e2e-v2/cases/nodejs/docker-compose.yml
+++ b/test/e2e-v2/cases/nodejs/docker-compose.yml
@@ -33,6 +33,7 @@ services:
context: .
dockerfile: Dockerfile.nodejs
args:
+ - SW_AGENT_NODEJS_REPO=${SW_AGENT_NODEJS_REPO}
- SW_AGENT_NODEJS_COMMIT=${SW_AGENT_NODEJS_COMMIT}
networks:
- e2e
@@ -70,6 +71,7 @@ services:
context: .
dockerfile: Dockerfile.nodejs
args:
+ - SW_AGENT_NODEJS_REPO=${SW_AGENT_NODEJS_REPO}
- SW_AGENT_NODEJS_COMMIT=${SW_AGENT_NODEJS_COMMIT}
networks:
- e2e
diff --git a/test/e2e-v2/cases/nodejs/e2e.yaml b/test/e2e-v2/cases/nodejs/e2e.yaml
index 0b348a7505..255a01b0b8 100644
--- a/test/e2e-v2/cases/nodejs/e2e.yaml
+++ b/test/e2e-v2/cases/nodejs/e2e.yaml
@@ -122,3 +122,15 @@ verify:
expected: expected/metrics-has-value.yml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_instance_nodejs_external_memory --instance-name=provider-instance --service-name=provider
expected: expected/metrics-has-value.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_instance_nodejs_array_buffers --instance-name=provider-instance --service-name=provider
+ expected: expected/metrics-has-value.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_instance_nodejs_uptime --instance-name=provider-instance --service-name=provider
+ expected: expected/metrics-has-value.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_instance_nodejs_peak_malloced_memory --instance-name=provider-instance --service-name=provider
+ expected: expected/metrics-has-value.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_instance_nodejs_malloced_memory --instance-name=provider-instance --service-name=provider
+ expected: expected/metrics-has-value.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_instance_nodejs_old_space_used --instance-name=provider-instance --service-name=provider
+ expected: expected/metrics-has-value.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_instance_nodejs_new_space_used --instance-name=provider-instance --service-name=provider
+ expected: expected/metrics-has-value.yml
diff --git a/test/e2e-v2/script/env b/test/e2e-v2/script/env
index 717d2db8db..54254068e9 100644
--- a/test/e2e-v2/script/env
+++ b/test/e2e-v2/script/env
@@ -16,7 +16,8 @@
SW_AGENT_JAVA_COMMIT=ac0df43d7140e726eba9e5e5b1b75cf364c71dff
SW_AGENT_SATELLITE_COMMIT=ea27a3f4e126a24775fe12e2aa2695bcb23d99c3
SW_AGENT_NGINX_LUA_COMMIT=c3cee4841798a147d83b96a10914d4ac0e11d0aa
-SW_AGENT_NODEJS_COMMIT=36df516f737bfc665dab7312703d826f9dcf527e
+SW_AGENT_NODEJS_REPO=https://github.com/apache/skywalking-nodejs.git
+SW_AGENT_NODEJS_COMMIT=6522a266a682c1c0cd4faa8c75c511a16d433f28
SW_AGENT_GO_COMMIT=754482220284b9c59d9e48c7f3cf943362eec41d
SW_AGENT_PYTHON_COMMIT=b91ebc46010ba6a46b251d4df54190c3b64f2db8
SW_AGENT_CLIENT_JS_COMMIT=f08776d909eb1d9bc79c600e493030651b97e491