validator

package
v0.0.0-...-1386544 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorLevel

type ErrorLevel int

ErrorLevel is the level of the validation error. The OpenMetrics spec defines rules in different categories like "SHOULD" and "MUST", the value of ErrorLevel identifies which category is the error falling into.

const (
	ErrorLevelShould ErrorLevel = iota
	ErrorLevelMust
)

A list of supported error levels, ordered by severity.

func NewErrorLevel

func NewErrorLevel(str string) (ErrorLevel, error)

NewErrorLevel creates an ErrorLevel.

func (ErrorLevel) String

func (el ErrorLevel) String() string

String returns a readable value for the error level. Use custom string value here because the standard string `ErrorLevelMust` is not ergnonomic in tooling.

type OpenMetricsValidator

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

OpenMetricsValidator validates metrics against OpenMetrics spec.

func NewValidator

func NewValidator(level ErrorLevel) *OpenMetricsValidator

NewValidator creates an OpenMetricsValidator.

func (*OpenMetricsValidator) Reset

func (v *OpenMetricsValidator) Reset()

Reset resets the validator.

func (*OpenMetricsValidator) Validate

func (v *OpenMetricsValidator) Validate(b []byte) error

Validate parses the bytes and validates the metrics against OpenMetrics spec.

Jump to

Keyboard shortcuts

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