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)
| 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. |
| 23 | func 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 | } |
no test coverage detected