Menu
Grafana Cloud

Configure NodeJS to generate Prometheus metrics

To configure NodeJS to generate Prometheus metrics, refer to Prometheus NodeJS Exporter.

Metrics and KPIs

MetricKPI

Memory

process_resident_memory_bytes

Utilization in k8s

process_resident_memory_bytes / kube_node_status_allocatable{resource=“memory”}

Utilization in non k8s

process_resident_memory_bytes / node_memory_MemTotal_bytes

CPU

process_cpu_seconds_total

Utilization in k8s

rate(process_cpu_seconds_total[5m]) / kube_pod_container_resource_limits{resource=“cpu”}

Utilization in non k8s

rate(process_cpu_seconds_total[5m]) / rate(node_cpu_seconds_total[5m])

Dashboard

In addition to these KPIs, the KPI dashboard includes the following NodeJS runtime metrics.

Heap usage

  • nodejs_heap_size_total_bytes
  • nodejs_heap_size_used_bytes
  • nodejs_heap_space_size_used_bytes

Event loop latency

  • nodejs_eventloop_lag_seconds
  • nodejs_eventloop_lag_p99_seconds

GC duration and count

  • rate(nodejs_gc_duration_seconds_sum[5m])
  • rate(nodejs_gc_duration_seconds_count[5m])

Active handles and requests

  • nodejs_active_handles_total
  • nodejs_active_reqeuests_total

File handles

  • process_open_fds
  • process_max_fds

NodeJS KPI dashboard