promlint

package
v1.20.5 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 38

Documentation

Overview

Package promlint provides a linter for Prometheus metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Linter

type Linter struct {
	// contains filtered or unexported fields
}

A Linter is a Prometheus metrics linter. It identifies issues with metric names, types, and metadata, and reports them to the caller.

func New

func New(r io.Reader) *Linter

New creates a new Linter that reads an input stream of Prometheus metrics in the Prometheus text exposition format.

func NewWithMetricFamilies

func NewWithMetricFamilies(mfs []*dto.MetricFamily) *Linter

NewWithMetricFamilies creates a new Linter that reads from a slice of MetricFamily protobuf messages.

func (*Linter) AddCustomValidations added in v1.18.0

func (l *Linter) AddCustomValidations(vs ...Validation)

AddCustomValidations adds custom validations to the linter.

func (*Linter) Lint

func (l *Linter) Lint() ([]Problem, error)

Lint performs a linting pass, returning a slice of Problems indicating any issues found in the metrics stream. The slice is sorted by metric name and issue description.

type Problem

type Problem struct {
	// The name of the metric indicated by this Problem.
	Metric string

	// A description of the issue for this Problem.
	Text string
}

A Problem is an issue detected by a linter.

type Validation added in v1.18.0

type Validation = func(mf *dto.MetricFamily) []error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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