Skip to content

Commit

Permalink
Use correct link for alert preview
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Nov 29, 2023
1 parent 9a82e12 commit 68ca0d7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v0.50.1

### Fixed

- Fixed alert preview link on `alerts/count` reports.

## v0.50.0

### Changed
Expand Down
2 changes: 1 addition & 1 deletion internal/checks/alerts_count.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (c AlertsCheck) Check(ctx context.Context, _ string, rule parser.Rule, _ []
Lines: lines,
Reporter: c.Reporter(),
Text: fmt.Sprintf("%s would trigger %d alert(s) in the last %s.", promText(c.prom.Name(), qr.URI), alerts, output.HumanizeDuration(delta)),
Details: fmt.Sprintf(`To get a preview of the alerts that would fire please [click here](%s/graph?g0.expr=%s&g0.range_input=%s).`,
Details: fmt.Sprintf(`To get a preview of the alerts that would fire please [click here](%s/graph?g0.expr=%s&g0.tab=1&g0.range_input=%s).`,
qr.PublicURI, url.QueryEscape(rule.AlertingRule.Expr.Value.Value), output.HumanizeDuration(delta),
),
Severity: c.severity,
Expand Down
2 changes: 1 addition & 1 deletion internal/checks/alerts_count_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func alertsText(name, uri string, count int, since string) string {

func alertsDetails(uri, query, since string) string {
return fmt.Sprintf(
`To get a preview of the alerts that would fire please [click here](%s/graph?g0.expr=%s&g0.range_input=%s).`,
`To get a preview of the alerts that would fire please [click here](%s/graph?g0.expr=%s&g0.tab=1&g0.range_input=%s).`,
uri, url.QueryEscape(query), since,
)
}
Expand Down

0 comments on commit 68ca0d7

Please sign in to comment.