From 9711b2b177959c0ea8e5119bead16dfd40b12c47 Mon Sep 17 00:00:00 2001 From: bndw Date: Sat, 14 Feb 2026 12:45:20 -0800 Subject: fix: dashboard prefix detection with Go runtime metrics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: Dashboard showed zeros because it detected "go" as the prefix instead of "muxstr" when Go runtime metrics appeared first in the metrics list. Fix: Search for the first metric containing "_relay_" to properly detect the namespace (muxstr, nostr-grpc, etc.) instead of using the first metric in the alphabetical list. Before: Object.keys(metrics)[0] → "go_gc_..." → prefix = "go" After: Find metric with "_relay_" → "muxstr_relay_..." → prefix = "muxstr" This fixes the dashboard displaying zeros when metrics data is present. --- internal/metrics/dashboard.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'internal/metrics/dashboard.html') diff --git a/internal/metrics/dashboard.html b/internal/metrics/dashboard.html index e7af48c..363f1f7 100644 --- a/internal/metrics/dashboard.html +++ b/internal/metrics/dashboard.html @@ -255,7 +255,8 @@ const text = await response.text(); const metrics = parsePrometheusMetrics(text); - const prefix = Object.keys(metrics)[0]?.split('_')[0] || 'muxstr'; + const relayMetric = Object.keys(metrics).find(k => k.includes('_relay_')); + const prefix = relayMetric ? relayMetric.split('_relay_')[0] : 'muxstr'; document.getElementById('active_connections').textContent = sumMetric(metrics, `${prefix}_relay_active_connections`); -- cgit v1.2.3