]> go.fuhry.dev Git - runtime.git/commitdiff
[metrics/metricbus] implement Add and Set on bare http counters and gauges
authorDan Fuhry <dan@fuhry.com>
Sat, 14 Mar 2026 23:10:23 +0000 (19:10 -0400)
committerDan Fuhry <dan@fuhry.com>
Sat, 14 Mar 2026 23:10:23 +0000 (19:10 -0400)
metrics/metricbus/mbclient/httpserver_metrics.go

index 695361e7d1678a5ecc877e2684a30962601e8074..49309761fe17fcd4412bd8bdcf1def8b51042686 100644 (file)
@@ -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 {