Enable Prometheus metrics#
To collect and expose metrics, n8n uses the prom-client library.
The /metrics endpoint is disabled by default, but it's possible to enable it using the N8N_METRICS environment variable.
Don't expose the metrics endpoint publicly
Only expose the /metrics endpoint to internal services that consume the Prometheus data. Don't make it accessible on the public internet, as it can reveal sensitive operational data about your n8n instance.
1 | |
Refer to the respective Environment Variables (N8N_METRICS_INCLUDE_*) for configuring which metrics and labels should get exposed.
Both main and worker instances are able to expose metrics.
Queue metrics#
To enable queue metrics, set the N8N_METRICS_INCLUDE_QUEUE_METRICS env var to true. You can adjust the refresh rate with N8N_METRICS_QUEUE_METRICS_INTERVAL.
n8n gathers these metrics from Bull and exposes them on the main instances. On multi-main setups, when aggregating queries, you can identify the leader using the instance_role_leader gauge, set to 1 for the leader main and 0 otherwise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |