From: Dan Fuhry Date: Sat, 14 Mar 2026 23:10:23 +0000 (-0400) Subject: [metrics/metricbus] implement Add and Set on bare http counters and gauges X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=456b15a75fe0e68fbd3a802420c6ff4e18c16e34;p=runtime.git [metrics/metricbus] implement Add and Set on bare http counters and gauges --- diff --git a/metrics/metricbus/mbclient/httpserver_metrics.go b/metrics/metricbus/mbclient/httpserver_metrics.go index 695361e..4930976 100644 --- a/metrics/metricbus/mbclient/httpserver_metrics.go +++ b/metrics/metricbus/mbclient/httpserver_metrics.go @@ -99,8 +99,8 @@ func (m *httpCounterMetric) Get() []bucket { return out } -func (m *httpCounterMetric) Add(_ float64) { - panic("unsupported") +func (m *httpCounterMetric) Add(v float64) { + m.WithLabelValues(metricbus.KV{}).Add(v) } func (m *httpCounterMetric) WithLabelValues(kv metricbus.KV) CounterMetric { @@ -151,12 +151,12 @@ func (m *httpGaugeMetric) WithLabelValues(kv metricbus.KV) GaugeMetric { return m.values[k] } -func (m *httpGaugeMetric) Set(_ float64) { - panic("unsupported") +func (m *httpGaugeMetric) Set(v float64) { + m.WithLabelValues(metricbus.KV{}).Set(v) } func (m *httpGaugeMetric) Reset() { - panic("unsupported") + m.WithLabelValues(metricbus.KV{}).Reset() } func (m *httpGaugeMetric) Get() []bucket {