Back to Skywalking

Node.js runtime metrics

docs/en/setup/backend/dashboards-nodejs-runtime.md

11.0.04.6 KB
Original Source

Node.js runtime metrics

The SkyWalking Node.js agent reports runtime metrics (process memory and CPU) through the MeterReportService gRPC protocol—the same pipeline used by the Go and Python agents. OAP analyzes raw meters via meter-analyzer-config/nodejs-runtime.yaml and stores meter_instance_nodejs_* metrics at the service instance level.

Platform support

Runtime meters are collected on Linux, macOS, and Windows via Node.js built-in APIs (process.memoryUsage(), process.cpuUsage(), process.uptime(), v8.getHeapStatistics(), v8.getHeapSpaceStatistics()).

Data flow

  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

Runtime metric reporting is on by default. Relevant environment variables:

VariableDescriptionDefault
SW_AGENT_NODEJS_RUNTIME_METRICS_REPORTER_ACTIVEMaster switch for runtime metric exporttrue
SW_AGENT_NODEJS_RUNTIME_METRICS_REPORT_PERIODSample + report interval in milliseconds20000

Deprecated aliases SW_AGENT_RUNTIME_METRICS_* / SW_AGENT_NVM_* for reporter active and report period are still accepted.

See the Node.js agent README for startup examples and the full field mapping from Node.js APIs to meter names.

OAP setup

Ensure the gRPC receiver is reachable on the port configured in SW_AGENT_COLLECTOR_BACKEND_SERVICES (default 11800). The nodejs-runtime meter analyzer file is included in the default meterAnalyzerActiveFiles list—no extra configuration is required for current Node.js agents.

Meter rules live in oap-server/server-starter/src/main/resources/meter-analyzer-config/nodejs-runtime.yaml.

UI location

Layer: General Service (GENERAL)

Path: select a Node.js service → InstanceDashboard

Widgets appear only when runtime data is present (visibleWhen checks each meter_instance_nodejs_* expression).

Runtime metrics

The agent reports twelve raw meter names; OAP prefixes them with meter_ when exposing queryable metrics:

UnitAgent meter nameOAP / UI metric nameDescriptionData Source
%instance_nodejs_process_cpumeter_instance_nodejs_process_cpuProcess CPU (user + system) over the report intervalSkyWalking Node.js Agent
bytesinstance_nodejs_heap_usedmeter_instance_nodejs_heap_usedV8 heap usedSkyWalking Node.js Agent
bytesinstance_nodejs_heap_totalmeter_instance_nodejs_heap_totalV8 heap totalSkyWalking Node.js Agent
bytesinstance_nodejs_heap_limitmeter_instance_nodejs_heap_limitV8 max heap sizeSkyWalking Node.js Agent
bytesinstance_nodejs_rssmeter_instance_nodejs_rssResident set sizeSkyWalking Node.js Agent
bytesinstance_nodejs_external_memorymeter_instance_nodejs_external_memoryExternal memorySkyWalking Node.js Agent
bytesinstance_nodejs_array_buffersmeter_instance_nodejs_array_buffersArrayBuffer / SharedArrayBuffer memorySkyWalking Node.js Agent
sinstance_nodejs_uptimemeter_instance_nodejs_uptimeProcess uptimeSkyWalking Node.js Agent
bytesinstance_nodejs_peak_malloced_memorymeter_instance_nodejs_peak_malloced_memoryPeak V8 malloced memorySkyWalking Node.js Agent
bytesinstance_nodejs_malloced_memorymeter_instance_nodejs_malloced_memoryCurrent V8 malloced memorySkyWalking Node.js Agent
bytesinstance_nodejs_old_space_usedmeter_instance_nodejs_old_space_usedV8 old generation heap usedSkyWalking Node.js Agent
bytesinstance_nodejs_new_space_usedmeter_instance_nodejs_new_space_usedV8 new generation heap usedSkyWalking Node.js Agent

Customizations

You can customize MAL expressions or dashboard panels. Metric definitions and expression rules are in meter-analyzer-config/nodejs-runtime.yaml. Instance dashboard widget templates ship from the SkyWalking Horizon UI bundle (general.json in apache/skywalking-horizon-ui).