From 68ca0d797634b78ef25544a7496cef26655e4e26 Mon Sep 17 00:00:00 2001 From: Lukasz Mierzwa Date: Wed, 29 Nov 2023 16:31:14 +0000 Subject: [PATCH] Use correct link for alert preview --- docs/changelog.md | 6 ++++++ internal/checks/alerts_count.go | 2 +- internal/checks/alerts_count_test.go | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 86e8faa6..2b419563 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,11 @@ # Changelog +## v0.50.1 + +### Fixed + +- Fixed alert preview link on `alerts/count` reports. + ## v0.50.0 ### Changed diff --git a/internal/checks/alerts_count.go b/internal/checks/alerts_count.go index 789a4b50..f5e462e7 100644 --- a/internal/checks/alerts_count.go +++ b/internal/checks/alerts_count.go @@ -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, diff --git a/internal/checks/alerts_count_test.go b/internal/checks/alerts_count_test.go index 6a098424..bfb641ce 100644 --- a/internal/checks/alerts_count_test.go +++ b/internal/checks/alerts_count_test.go @@ -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, ) }