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

Function getMetric

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

Source from the content-addressed store, hash-verified

61}
62
63func getMetric(t testing.TB, metrics []*dto.MetricFamily, name string, labels ...string) *dto.Metric {
64 for _, family := range metrics {
65 if family.GetName() != name {
66 continue
67 }
68 ms := family.GetMetric()
69 metricsLoop:
70 for _, m := range ms {
71 require.Equal(t, len(labels), len(m.GetLabel()))
72 for i, lv := range labels {
73 if lv != m.GetLabel()[i].GetValue() {
74 continue metricsLoop
75 }
76 }
77
78 return m
79 }
80 }
81
82 return nil
83}

Callers 3

PromCounterGatheredFunction · 0.85
PromGaugeGatheredFunction · 0.85
getValueFunction · 0.85

Calls 3

GetNameMethod · 0.45
EqualMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected