MCPcopy
hub / github.com/grafana/tempo / GetCounterVecValue

Function GetCounterVecValue

pkg/util/test/metrics.go:35–41  ·  view source on GitHub ↗
(metric *prometheus.CounterVec, label string)

Source from the content-addressed store, hash-verified

33}
34
35func GetCounterVecValue(metric *prometheus.CounterVec, label string) (float64, error) {
36 m := &dto.Metric{}
37 if err := metric.WithLabelValues(label).Write(m); err != nil {
38 return 0, err
39 }
40 return m.Counter.GetValue(), nil
41}
42
43func MustGetCounterValue(metric prometheus.Counter) float64 {
44 value, err := GetCounterValue(metric)

Calls 2

WriteMethod · 0.65
GetValueMethod · 0.45