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

Function CounterValue

coderd/coderdtest/promhelp/metrics.go:59–65  ·  view source on GitHub ↗

CounterValue returns the value of a counter metric with the given name and labels.

(t testing.TB, reg prometheus.Gatherer, metricName string, labels prometheus.Labels)

Source from the content-addressed store, hash-verified

57
58// CounterValue returns the value of a counter metric with the given name and labels.
59func CounterValue(t testing.TB, reg prometheus.Gatherer, metricName string, labels prometheus.Labels) int {
60 t.Helper()
61
62 labeled := MetricValue(t, reg, metricName, labels)
63 require.NotNilf(t, labeled, "metric %q with labels %v not found", metricName, labels)
64 return int(labeled.GetCounter().GetValue())
65}
66
67func MetricValue(t testing.TB, reg prometheus.Gatherer, metricName string, labels prometheus.Labels) *io_prometheus_client.Metric {
68 t.Helper()

Callers 7

TestConcurrencyFunction · 0.92
TestReleaseFunction · 0.92
TestInTxMetricsFunction · 0.92
TestMetricsFunction · 0.92
TestPurgeChatDebugRunsFunction · 0.92
TestInstrumentFunction · 0.92

Calls 3

MetricValueFunction · 0.85
HelperMethod · 0.65
GetValueMethod · 0.45

Tested by 7

TestConcurrencyFunction · 0.74
TestReleaseFunction · 0.74
TestInTxMetricsFunction · 0.74
TestMetricsFunction · 0.74
TestPurgeChatDebugRunsFunction · 0.74
TestInstrumentFunction · 0.74