Node.js runtime metrics

The agent reports 12 process-level meters through SkyWalking MeterReportService. Runtime metrics are enabled by default. The default sample and report period is 20 seconds.

Reported meters

Meter nameNode.js sourceUnit or value
instance_nodejs_process_cpuprocess.cpuUsage()Percent, user plus system CPU, divided by the logical CPU count
instance_nodejs_heap_usedprocess.memoryUsage().heapUsedBytes
instance_nodejs_heap_totalprocess.memoryUsage().heapTotalBytes
instance_nodejs_heap_limitv8.getHeapStatistics().heap_size_limitBytes
instance_nodejs_rssprocess.memoryUsage().rssBytes
instance_nodejs_external_memoryprocess.memoryUsage().externalBytes
instance_nodejs_array_buffersprocess.memoryUsage().arrayBuffersBytes
instance_nodejs_uptimeprocess.uptime()Seconds
instance_nodejs_peak_malloced_memoryv8.getHeapStatistics().peak_malloced_memoryBytes
instance_nodejs_malloced_memoryv8.getHeapStatistics().malloced_memoryBytes
instance_nodejs_old_space_usedv8.getHeapSpaceStatistics() old spaceBytes
instance_nodejs_new_space_usedv8.getHeapSpaceStatistics() new spaceBytes

CPU is calculated from the change in user and system CPU time between samples. The result is divided by the number of logical CPUs, so its normal range is 0 to 100 percent for the whole Node.js process.

Configure reporting

Disable runtime meters:

export SW_AGENT_NODEJS_RUNTIME_METRICS_REPORTER_ACTIVE=false

Change the period to 30 seconds:

export SW_AGENT_NODEJS_RUNTIME_METRICS_REPORT_PERIOD=30000

The period must be a positive integer in milliseconds. The same period controls sampling and reporting. A shorter period creates more work in the agent and OAP.

The matching agent.start() options are runtimeMetricsReporterActive and runtimeMetricsReportPeriod. See Configuration for old option names.

OAP dashboard

OAP must include the Node.js runtime meter rules and dashboard. The OAP setup maps the raw instance_nodejs_* meters to stored metrics whose names start with meter_.

See the Node.js runtime dashboard setup in the main SkyWalking documentation.

Flush behavior

agent.flush() takes a current runtime sample and asks the meter reporter to send it. The reporter does not keep a backlog of old meter values. A sample that cannot be sent is discarded.

Custom business metrics are not available through a stable public API in this package.