启用 Prometheus 指标#
¥Enable Prometheus metrics
n8n 使用 prom-client 库来收集和公开指标。
¥To collect and expose metrics, n8n uses the prom-client library.
/metrics 端点默认处于禁用状态,但可以使用 N8N_METRICS 环境变量启用它。
¥The /metrics endpoint is disabled by default, but it's possible to enable it using the N8N_METRICS environment variable.
1 | |
请参阅相应的 环境变量 (N8N_METRICS_INCLUDE_*) 以配置要公开哪些指标和标签。
¥Refer to the respective Environment Variables (N8N_METRICS_INCLUDE_*) for configuring which metrics and labels should get exposed.
main 和 worker 实例都能够公开指标。
¥Both main and worker instances are able to expose metrics.
队列指标#
¥Queue metrics
要启用队列指标,请将 N8N_METRICS_INCLUDE_QUEUE_METRICS 环境变量设置为 true。你可以使用 N8N_METRICS_QUEUE_METRICS_INTERVAL 调整刷新频率。
¥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 从 Bull 收集这些指标,并在主实例上公开它们。在多主节点配置中,聚合查询时,你可以使用 instance_role_leader 指标来识别领导者节点,将 instance_role_leader 设置为 1 表示领导者节点,否则设置为 0。
¥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 | |