diff --git a/rules/alerting.go b/rules/alerting.go index 6a489cfa8..817a7078e 100644 --- a/rules/alerting.go +++ b/rules/alerting.go @@ -332,8 +332,8 @@ func (r *AlertingRule) HTMLSnippet(pathPrefix string) html_template.HTML { model.MetricNameLabel: alertMetricName, alertNameLabel: model.LabelValue(r.name), } - s := fmt.Sprintf("ALERT %s", pathPrefix+strutil.GraphLinkForExpression(alertMetric.String()), r.name) - s += fmt.Sprintf("\n IF %s", pathPrefix+strutil.GraphLinkForExpression(r.vector.String()), html_template.HTMLEscapeString(r.vector.String())) + s := fmt.Sprintf("ALERT %s", pathPrefix+strutil.TableLinkForExpression(alertMetric.String()), r.name) + s += fmt.Sprintf("\n IF %s", pathPrefix+strutil.TableLinkForExpression(r.vector.String()), html_template.HTMLEscapeString(r.vector.String())) if r.holdDuration > 0 { s += fmt.Sprintf("\n FOR %s", model.Duration(r.holdDuration)) } diff --git a/rules/alerting_test.go b/rules/alerting_test.go index 3f7d4953f..d12f0dec7 100644 --- a/rules/alerting_test.go +++ b/rules/alerting_test.go @@ -27,8 +27,8 @@ func TestAlertingRuleHTMLSnippet(t *testing.T) { } rule := NewAlertingRule("testrule", expr, 0, model.LabelSet{"html": "BOLD"}, model.LabelSet{"html": "BOLD"}) - const want = `ALERT testrule - IF foo{html="<b>BOLD<b>"} + const want = `ALERT testrule + IF foo{html="<b>BOLD<b>"} LABELS {html="<b>BOLD</b>"} ANNOTATIONS {html="<b>BOLD</b>"}` diff --git a/rules/manager.go b/rules/manager.go index 8b017c55a..2d972a9cf 100644 --- a/rules/manager.go +++ b/rules/manager.go @@ -331,7 +331,7 @@ func (g *Group) sendAlerts(rule *AlertingRule, timestamp model.Time) error { StartsAt: alert.ActiveAt.Add(rule.holdDuration).Time(), Labels: alert.Labels, Annotations: alert.Annotations, - GeneratorURL: g.opts.ExternalURL.String() + strutil.GraphLinkForExpression(rule.vector.String()), + GeneratorURL: g.opts.ExternalURL.String() + strutil.TableLinkForExpression(rule.vector.String()), } if alert.ResolvedAt != 0 { a.EndsAt = alert.ResolvedAt.Time() diff --git a/rules/recording.go b/rules/recording.go index 70fd75582..442986ea6 100644 --- a/rules/recording.go +++ b/rules/recording.go @@ -106,9 +106,9 @@ func (rule RecordingRule) HTMLSnippet(pathPrefix string) template.HTML { ruleExpr := rule.vector.String() return template.HTML(fmt.Sprintf( `%s%s = %s`, - pathPrefix+strutil.GraphLinkForExpression(rule.name), + pathPrefix+strutil.TableLinkForExpression(rule.name), rule.name, template.HTMLEscapeString(rule.labels.String()), - pathPrefix+strutil.GraphLinkForExpression(ruleExpr), + pathPrefix+strutil.TableLinkForExpression(ruleExpr), template.HTMLEscapeString(ruleExpr))) } diff --git a/rules/recording_test.go b/rules/recording_test.go index 472eeef4d..730548d5e 100644 --- a/rules/recording_test.go +++ b/rules/recording_test.go @@ -80,7 +80,7 @@ func TestRecordingRuleHTMLSnippet(t *testing.T) { } rule := NewRecordingRule("testrule", expr, model.LabelSet{"html": "BOLD"}) - const want = `testrule{html="<b>BOLD</b>"} = foo{html="<b>BOLD<b>"}` + const want = `testrule{html="<b>BOLD</b>"} = foo{html="<b>BOLD<b>"}` got := rule.HTMLSnippet("/test/prefix") if got != want {