Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Various typos and word ordering in validator messages. #27

Merged
merged 2 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/validator/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand All @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions pkg/validator/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)}
}
Expand Down