From b5b43b5fd6c717d789d6e645de7d3bd10a906d03 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Jan 2026 04:13:42 +0000 Subject: [PATCH] fix: use different metric name to avoid conflict with collectDefaultMetrics --- src/Utils/prometheus-metrics.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Utils/prometheus-metrics.ts b/src/Utils/prometheus-metrics.ts index 3c94b16f..dc2b5dab 100644 --- a/src/Utils/prometheus-metrics.ts +++ b/src/Utils/prometheus-metrics.ts @@ -1076,15 +1076,12 @@ export class SystemMetricsCollector { new Gauge('system_load_average', 'System load average', ['period']) ) - // Event loop lag - check if already exists (may be created by collectDefaultMetrics) - const existingEventLoopLag = getExistingMetric('nodejs_eventloop_lag_seconds') - if (existingEventLoopLag) { - this.eventLoopLag = existingEventLoopLag - } else { - this.eventLoopLag = registry.register( - new Histogram('nodejs_eventloop_lag_seconds', 'Event loop lag in seconds', [], DEFAULT_LATENCY_BUCKETS) - ) - } + // Event loop lag - use different name to avoid conflict with collectDefaultMetrics + // prom-client's collectDefaultMetrics creates nodejs_eventloop_lag_seconds + // We use system_eventloop_lag_seconds to avoid duplicate registration + this.eventLoopLag = registry.register( + new Histogram('system_eventloop_lag_seconds', 'Event loop lag in seconds', [], DEFAULT_LATENCY_BUCKETS) + ) // Initialize CPU baseline this.lastCpuUsage = process.cpuUsage()