MCPcopy Index your code
hub / github.com/coder/coder / getValue

Function getValue

testutil/prometheus.go:47–61  ·  view source on GitHub ↗
(t testing.TB, metrics []*dto.MetricFamily, kind kind, name string, labels ...string)

Source from the content-addressed store, hash-verified

45}
46
47func getValue(t testing.TB, metrics []*dto.MetricFamily, kind kind, name string, labels ...string) float64 {
48 m := getMetric(t, metrics, name, labels...)
49 if m == nil {
50 return -1
51 }
52
53 switch kind {
54 case counterKind:
55 return m.GetCounter().GetValue()
56 case gaugeKind:
57 return m.GetGauge().GetValue()
58 default:
59 return -1
60 }
61}
62
63func getMetric(t testing.TB, metrics []*dto.MetricFamily, name string, labels ...string) *dto.Metric {
64 for _, family := range metrics {

Callers 4

PromGaugeHasValueFunction · 0.85
PromCounterHasValueFunction · 0.85
PromGaugeAssertionFunction · 0.85
PromCounterAssertionFunction · 0.85

Calls 2

getMetricFunction · 0.85
GetValueMethod · 0.45

Tested by

no test coverage detected