MCPcopy Create free account
hub / github.com/PostHog/duckgres / counterValue

Function counterValue

cmd/cache-proxy/cache_test.go:18–25  ·  view source on GitHub ↗

counterValue reads a Prometheus counter's current value without pulling in the testutil package (and its extra module deps). Used to assert the Open-vs- openFile hit-count split.

(t *testing.T, c prometheus.Counter)

Source from the content-addressed store, hash-verified

16 "github.com/prometheus/client_golang/prometheus"
17 dto "github.com/prometheus/client_model/go"
18)
19
20// counterValue reads a Prometheus counter's current value without pulling in the
21// testutil package (and its extra module deps). Used to assert the Open-vs-
22// openFile hit-count split.
23func counterValue(t *testing.T, c prometheus.Counter) float64 {
24 t.Helper()
25 var m dto.Metric
26 if err := c.Write(&m); err != nil {
27 t.Fatalf("read counter: %v", err)
28 }

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected