Customize "OPEN IN GRAFANA" widget in Google Chat
Opened this issue · 2 comments
Hello,
I recently upgrade Grafana to version 9.x and previously the button "OPEN IN GRAFANA" used to have a link to the panel where it's alert comes from.
But now it always send to "alert list page" that isn't useful to analyse the alert itself because alert list do not show the metrics.
I'd like to request a way to customize this button maybe from template or something like that.
Thanks.
This change is likely caused by the automatic upgrade to Unified Alerting in 9.x. It should be possible to template the direct link to the alert by using the {{ .GeneratorURL }}
field of an individual alert. Something like:
{{ range .Alerts }}
{{ .GeneratorURL }}
{{ end }}
Or if you know the alerts are all from the same rule you can just use the first one:
{{ (index .Alerts 0).GeneratorURL }}
You can find more information here: https://grafana.com/docs/grafana/latest/alerting/configure-notifications/template-notifications/
If this isn't enough we can consider creating a feature request to have this value in the default template similar to Slack.
This change is likely caused by the automatic upgrade to Unified Alerting in 9.x. It should be possible to template the direct link to the alert by using the
{{ .GeneratorURL }}
field of an individual alert. Something like:
I'm talking about the button that's currently hardcoded in Google Chat receiver https://github.com/grafana/alerting/blob/main/receivers/googlechat/googlechat.go#L67
The workaround to put a link in the alert message is ok, but having a way to customize the button url would be better (to keep the previous behaviour)