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.