Skip to content

Commit

Permalink
Fix fallback message
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Oct 3, 2024
1 parent 9024afa commit 374e1c3
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions internal/checks/promql_series.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ func (c SeriesCheck) checkOtherServer(ctx context.Context, query string, timeout
return SeriesCheckCommonProblemDetails
}

var suffix string
var buf strings.Builder
buf.WriteRune('`')
buf.WriteString(query)
Expand All @@ -603,13 +604,8 @@ func (c SeriesCheck) checkOtherServer(ctx context.Context, query string, timeout
slog.String("check", c.Reporter()),
slog.String("selector", query),
)
buf.WriteString("\npint tried to check ")
buf.WriteString(strconv.Itoa(len(servers)))
buf.WriteString(" server(s) but stopped after checking ")
buf.WriteString(strconv.Itoa(tested))
buf.WriteString(" server(s) due to reaching time limit (")
buf.WriteString(output.HumanizeDuration(timeout))
buf.WriteString(").\n")
suffix = fmt.Sprintf("\npint tried to check %d server(s) but stopped after checking %d server(s) due to reaching time limit (%s).\n",
len(servers), tested, output.HumanizeDuration(timeout))
break
}

Expand Down Expand Up @@ -652,6 +648,7 @@ func (c SeriesCheck) checkOtherServer(ctx context.Context, query string, timeout
buf.WriteString(strconv.Itoa(skipped))
buf.WriteString(" other server(s).\n")
}
buf.WriteString(suffix)

buf.WriteString("\nYou might be trying to deploy this rule to the wrong Prometheus server instance.\n")

Expand Down

0 comments on commit 374e1c3

Please sign in to comment.