summaryrefslogtreecommitdiffstats
path: root/internal/metrics
diff options
context:
space:
mode:
authorbndw <ben@bdw.to>2026-02-14 12:45:20 -0800
committerbndw <ben@bdw.to>2026-02-14 12:45:20 -0800
commit9711b2b177959c0ea8e5119bead16dfd40b12c47 (patch)
treef4457972eafca456d658736b9bfd603002ca096b /internal/metrics
parent860a662ebdfd9b2bd27a754283a25427d13fecbc (diff)
fix: dashboard prefix detection with Go runtime metrics
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.
Diffstat (limited to 'internal/metrics')
-rw-r--r--internal/metrics/dashboard.html3
1 files changed, 2 insertions, 1 deletions
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 @@
255 const text = await response.text(); 255 const text = await response.text();
256 const metrics = parsePrometheusMetrics(text); 256 const metrics = parsePrometheusMetrics(text);
257 257
258 const prefix = Object.keys(metrics)[0]?.split('_')[0] || 'muxstr'; 258 const relayMetric = Object.keys(metrics).find(k => k.includes('_relay_'));
259 const prefix = relayMetric ? relayMetric.split('_relay_')[0] : 'muxstr';
259 260
260 document.getElementById('active_connections').textContent = 261 document.getElementById('active_connections').textContent =
261 sumMetric(metrics, `${prefix}_relay_active_connections`); 262 sumMetric(metrics, `${prefix}_relay_active_connections`);