Documentation
¶
Overview ¶
Package metricstest provides test helpers for asserting that components correctly register and update Prometheus metrics.
Use New to obtain an isolated metrics.Metrics instance backed by a fresh prometheus.Registry. Call Gather to retrieve the current metric families and assert on their values without involving the process-global default registry.
Warning: this package is intended for use in tests only.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Gather ¶
Gather collects all metric families from m and returns them keyed by fully- qualified metric name. The test fails immediately if gathering returns an error.
func New ¶
New returns an isolated metrics.Metrics instance backed by a fresh registry. The component is NOT started: Go runtime and process collectors are not registered, keeping gathered output minimal and deterministic.
Pass the returned metrics.Metrics to the component under test, then call Gather to inspect the resulting metric families.
Types ¶
This section is empty.