promhelp

package
v2.21.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

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