promhelp

package
v2.29.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package promhelp provides helper functions for asserting Prometheus metric values in unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(reg prometheus.Gatherer, compare string, metricNames ...string) error

Compare can be used to compare a registry to some prometheus formatted text. If any values differ, an error is returned. If metric names are passed in, only those metrics will be compared. Usage: `Compare(reg, RegistryDump(reg))`

func CounterValue

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

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

func GaugeValue

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

GaugeValue returns the value of a gauge metric with the given name and labels.

func HistogramValue

func HistogramValue(t testing.TB, reg prometheus.Gatherer, metricName string, labels prometheus.Labels) *io_prometheus_client.Histogram

HistogramValue returns the value of a histogram metric with the given name and labels.

func MetricValue

func MetricValue(t testing.TB, reg prometheus.Gatherer, metricName string, labels prometheus.Labels) *io_prometheus_client.Metric

func RegistryDump

func RegistryDump(reg *prometheus.Registry) string

RegistryDump returns the http page for a given registry's metrics. Very useful for visual debugging.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL