Documentation
¶
Overview ¶
Package validators contains various validators.
Index ¶
- Constants
- func ValidateAWSPartitions(partitions []string) error
- func ValidateAlertingRules(ctx context.Context, rules string) error
- func ValidateDataRetention(value time.Duration) (time.Duration, error)
- func ValidateMetricResolution(value time.Duration) (time.Duration, error)
- func ValidateSTTCheckInterval(value time.Duration) (time.Duration, error)
- type DurationNotAllowedError
- type InvalidAlertingRuleError
- type MinDurationError
Constants ¶
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 // STTCheckIntervalMin is the smallest value STT check intervals can accept. STTCheckIntervalMin = time.Second // STTCheckIntervalMultipleOf is value STT check intervals should be multiple of. STTCheckIntervalMultipleOf = 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 ¶
ValidateAWSPartitions validates AWS partitions list.
func ValidateAlertingRules ¶
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 ¶
ValidateDataRetention validate metric resolution.
func ValidateMetricResolution ¶
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 ¶
MinDurationError minimum allowed duration error.
func (MinDurationError) Error ¶
func (e MinDurationError) Error() string