Skip to content

Commit

Permalink
add comments in url-template
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoBrigitte committed Jan 6, 2025
1 parent 1a5e321 commit cb2a4b3
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
{{`
{{/*
__alerturl is the link pointing to a page in Grafana with details and source expressiong of the alert.
/*}}
{{ define "__alerturl" }}`}}{{ .Values.alerting.grafanaAddress }}{{`/alerting/Mimir/{{ .CommonLabels.alertname }}/find{{ end }}

{{/*
__dashboardurl is the link pointing the Grafana dashboard referenced in the alert annotation if any.
/*}}
{{ define "__dashboardurl" -}}
{{- if match "^https://.+" (index .Alerts 0).Annotations.dashboard }}{{ (index .Alerts 0).Annotations.dashboard -}}
{{- else -}}
`}}{{ .Values.alerting.grafanaAddress }}{{`/d/{{ (index .Alerts 0).Annotations.dashboard -}}
{{- end -}}
{{- end }}

{{/*
__queryurl is the link pointing to Grafana explore with the alert expression prefilled.

grafanaExploreURL is a Mimir Alertmanager specific template function: https://grafana.com/docs/mimir/latest/references/architecture/components/alertmanager/#templating, its second argument is the datasource id
/*}}
{{ define "__queryurl" -}}
{{- grafanaExploreURL "`}}{{ .Values.alerting.grafanaAddress }}{{`" "ce76fwwsnhipsa" "now-1h" "now" (queryFromGeneratorURL (index .Alerts 0).GeneratorURL) -}}
{{- end }}

{{/*
__runbookurl is a link to the intranet's opsrecipe referenced in the alert annotation.
*/}}
{{ define "__runbookurl" -}}https://intranet.giantswarm.io/docs/support-and-ops/ops-recipes/{{ (index .Alerts 0).Annotations.opsrecipe }}{{- end }}
`}}

0 comments on commit cb2a4b3

Please sign in to comment.