promtest

package module
v0.0.0-...-998bde2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: MIT Imports: 13 Imported by: 0

README

promtest builds.sr.ht status GoDoc Go Report Card

Package promtest provides helpers for testing applications which export Prometheus metrics. MIT Licensed.

Documentation

Overview

Package promtest provides helpers for testing applications which export Prometheus metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collect

func Collect(t *testing.T, c prometheus.Collector) []byte

Collect sets up a temporary HTTP server and performs a single scrape of the metrics provided by c. The metrics data is returned as a byte slice for further inspection by other functions in this package.

func Lint

func Lint(t *testing.T, body []byte) bool

Lint reports whether the Prometheus metrics in body comply with promlint best practices. It returns false if any issues were found.

func Match

func Match(t *testing.T, body []byte, metrics []string) bool

Match reports whether each Prometheus metric in body (ignoring metadata such as HELP and TYPE) matches a metric from the input metrics slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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