---
title: "Configure NodeJS to generate Prometheus metrics | Grafana Cloud documentation"
description: "Configure a NodeJS application to send metrics"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Configure NodeJS to generate Prometheus metrics

To configure NodeJS to generate Prometheus metrics, refer to [Prometheus NodeJS Exporter](https://github.com/siimon/prom-client).

## Metrics and KPIs

Expand table

| **Metric**                                                    | **KPI**                                                                                                                                                                                                                                                                            |
|---------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Memory<br /><br /><br /><br />`process_resident_memory_bytes` | Utilization in k8s<br /><br /><br /><br />`process_resident_memory_bytes / kube_node_status_allocatable{resource=“memory”}`<br /><br /><br /><br />Utilization in non k8s<br /><br /><br /><br />`process_resident_memory_bytes / node_memory_MemTotal_bytes`                      |
| CPU<br /><br /><br /><br />`process_cpu_seconds_total`        | Utilization in k8s<br /><br /><br /><br />`rate(process_cpu_seconds_total[5m]) / kube_pod_container_resource_limits{resource=“cpu”}`<br /><br /><br /><br />Utilization in non k8s<br /><br /><br /><br />`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
