diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dd4399..bd42333 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- [#27](https://github.com/FUSAKLA/promruval/pull/27) + - typos and wording in validator messages were corrected + ## [v2.3.0] - 2022-06-07 - [#25](https://github.com/FUSAKLA/promruval/pull/25) diff --git a/pkg/validator/expression.go b/pkg/validator/expression.go index 9dd572f..2a76892 100644 --- a/pkg/validator/expression.go +++ b/pkg/validator/expression.go @@ -119,7 +119,7 @@ type expressionDoesNotUseRangeShorterThan struct { } func (h expressionDoesNotUseRangeShorterThan) String() string { - return fmt.Sprintf("expr does not use range selctor shorter than `%s`", h.limit) + return fmt.Sprintf("expr does not use range selector shorter than `%s`", h.limit) } func (h expressionDoesNotUseRangeShorterThan) Validate(rule rulefmt.Rule, _ *prometheus.Client) []error { @@ -279,10 +279,10 @@ type expressionCanBeEvaluated struct { func (h expressionCanBeEvaluated) String() string { msg := "expression can be successfully evaluated on the live Prometheus instance" if h.timeSeriesLimit > 0 { - msg += fmt.Sprintf(" and number of time series it the result is not higher than %d", h.timeSeriesLimit) + msg += fmt.Sprintf(" and the number of time series in the result is not higher than %d", h.timeSeriesLimit) } if h.evaluationDurationLimit != 0 { - msg += fmt.Sprintf(" and the evaluation is no loger than %s ", h.evaluationDurationLimit) + msg += fmt.Sprintf(" and the evaluation is not longer than %s", h.evaluationDurationLimit) } return msg } @@ -298,7 +298,7 @@ func (h expressionCanBeEvaluated) Validate(rule rulefmt.Rule, prometheusClient * return append(errs, err) } if h.timeSeriesLimit != 0 && count > h.timeSeriesLimit { - errs = append(errs, fmt.Errorf("query returned %d series exceeding the %d limit", count, h.timeSeriesLimit)) + errs = append(errs, fmt.Errorf("query returned %d series exceeding the limit %d", count, h.timeSeriesLimit)) } if h.evaluationDurationLimit != 0 && duration > h.evaluationDurationLimit { errs = append(errs, fmt.Errorf("query took %s which exceeds the configured maximum %s", duration, h.evaluationDurationLimit)) diff --git a/pkg/validator/labels.go b/pkg/validator/labels.go index 0fc753d..6807b5f 100644 --- a/pkg/validator/labels.go +++ b/pkg/validator/labels.go @@ -200,7 +200,7 @@ func newLabelMatchesRegexp(paramsConfig yaml.Node) (Validator, error) { return nil, err } if params.Label == "" { - return nil, fmt.Errorf("missing lanel name") + return nil, fmt.Errorf("missing label name") } expr, err := regexp.Compile(params.Regexp) if err != nil { @@ -284,7 +284,7 @@ func (h exclusiveLabels) String() string { if h.label1Value != "" { text += fmt.Sprintf("with value `%s` ", h.label1Value) } - text += fmt.Sprintf(", it cannot has a label `%s`", h.label2) + text += fmt.Sprintf(", it cannot have label `%s`", h.label2) if h.label2Value != "" { text += fmt.Sprintf("with value `%s` ", h.label2Value) } @@ -304,7 +304,7 @@ func (h exclusiveLabels) Validate(rule rulefmt.Rule, _ *prometheus.Client) []err if !hasLabel2 { return []error{} } - errMsg += fmt.Sprintf(", it cannot has label `%s`", h.label2) + errMsg += fmt.Sprintf(", it cannot have label `%s`", h.label2) if h.label2Value == "" { return []error{fmt.Errorf(errMsg)} }