validators

package
v2.15.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package validators contains various validators.

Index

Constants

View Source
const (
	// MetricsResolutionMin is the smallest value metric resolution can accept.
	MetricsResolutionMin = time.Second
	// MetricsResolutionMultipleOf is value metrics resolution should be multiple of.
	MetricsResolutionMultipleOf = time.Second
	// DataRetentionMin is the smallest value data retention can accept.
	DataRetentionMin = 24 * time.Hour
	// DataRetentionMultipleOf is a value of data retention should be multiple of.
	DataRetentionMultipleOf = 24 * time.Hour
)

Variables

This section is empty.

Functions

func ValidateAWSPartitions

func ValidateAWSPartitions(partitions []string) error

ValidateAWSPartitions validates AWS partitions list.

func ValidateAlertingRules

func ValidateAlertingRules(ctx context.Context, rules string) error

ValidateAlertingRules validates alerting rules (https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) by storing them in temporary file and calling `vmalert -dryRun -rule`. Returned error is nil, *InvalidAlertingRuleError for "normal" validation errors, or some other fatal error.

func ValidateDataRetention

func ValidateDataRetention(value time.Duration) (time.Duration, error)

ValidateDataRetention validate metric resolution.

func ValidateMetricResolution

func ValidateMetricResolution(value time.Duration) (time.Duration, error)

ValidateMetricResolution validate metric resolution.

Types

type DurationNotAllowedError

type DurationNotAllowedError struct {
	Msg string
}

DurationNotAllowedError duration not allowed error.

func (DurationNotAllowedError) Error

func (e DurationNotAllowedError) Error() string

type InvalidAlertingRuleError

type InvalidAlertingRuleError struct {
	Msg string
}

InvalidAlertingRuleError represents "normal" alerting rule validation error.

func (*InvalidAlertingRuleError) Error

func (e *InvalidAlertingRuleError) Error() string

Error implements error interface.

type MinDurationError

type MinDurationError struct {
	Msg string
	Min time.Duration
}

MinDurationError minimum allowed duration error.

func (MinDurationError) Error

func (e MinDurationError) Error() string

Jump to

Keyboard shortcuts

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