Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alerting: Slack Alert title links to alerting/list rather than the alert-rule #69248

Open
michael-sawczuk opened this issue May 30, 2023 · 9 comments · May be fixed by grafana/alerting#241
Open
Labels
area/alerting/notifications Issues when sending alert notifications area/alerting Grafana Alerting area/backend area/templating/repeating Repeating panels or rows effort/medium good first issue Good for newcomers prio/high Must be staffed and worked on either currently, or very soon, ideally in time for the next release. type/bug

Comments

@michael-sawczuk
Copy link

michael-sawczuk commented May 30, 2023

What went wrong?

What happened:
Since moving to Grafana 9 and unified alerting, the slack title only links to <grafana_base_url>/alerting/list - this isn't helpful as you need to search for the alert-rule in a firing state AND potentially swap orgs as orgId is not specified with the title.

What did you expect to happen:
The slack title should contain the orgId and link to either the dashboard/panel, failing that the generator URL.

How do we reproduce it?

Step 1:
Open grafana with multiple orgs available, choose an org to create an alert-rule in.

Step 2:
Create an alert-rule with a dashboard/panel link and a Slack contact point to send the alert to (the default template is fine).

Step 3:
Cause the alert-rule to go into an alerting state

Step 4:
Click the Slack title, you will find there is no orgId parameter and it will link to <grafana_base_url>/alerting/list

What Grafana version are you using?

Grafana 9.3.0, v9.4, v9.5

Optional Questions:

Is the bug inside a Dashboard Panel?

No response

Grafana Platform?

A package manager (APT, YUM, BREW, etc.)

User's OS?

MacOS Ventura

User's Browser?

Firefox

Is this a Regression?

None

Are Datasources involved?

No response

Anything else to add?

No response

@usmangt usmangt added area/alerting Grafana Alerting area/alerting/notifications Issues when sending alert notifications area/templating/repeating Repeating panels or rows labels May 30, 2023
@usmangt usmangt added the triage/needs-confirmation used for OSS triage rotation - reported issue needs to be reproduced label May 30, 2023
@grobinson-grafana
Copy link
Contributor

Hi! 👋

The Slack title links to alerting/list because notifications can contain multiple alerts. This is different from legacy alerting where you would only have one alert in each notification.

Your complaint org_id is valid though, we've looked at the code and think this is a bug, so we will fix it!

@grobinson-grafana grobinson-grafana added area/backend and removed triage/needs-confirmation used for OSS triage rotation - reported issue needs to be reproduced labels Jun 2, 2023
@grobinson-grafana grobinson-grafana moved this to Inbox in Alerting Jun 2, 2023
@michael-sawczuk
Copy link
Author

Thanks @grobinson-grafana, would be nice if there is only a single alert to link directly to it

@armandgrillet
Copy link
Contributor

This is indeed not a great UX and this is the case for many contact points. We need to change https://github.com/grafana/alerting/blob/55b8d71c7890fb3d685790a6e3a6c1c8b0c5ebc9/receivers/slack/slack.go#LL290C2-L290C90 to be the generatorURL if only one alert is sent back by the notification.

@armandgrillet armandgrillet moved this from Inbox to Backlog in Alerting Jun 9, 2023
@armandgrillet armandgrillet added prio/high Must be staffed and worked on either currently, or very soon, ideally in time for the next release. good first issue Good for newcomers effort/small effort/medium and removed effort/small labels Jun 9, 2023
@insaaniManav
Copy link

Is this done ? would love to pick this up

@Ondrej-Sevce
Copy link

Ondrej-Sevce commented Jun 30, 2023

There are users who miss the ability to customise Alert Slack Notification title link destination.
Are there any plans to allow to override this with a go template, for example?

https://community.grafana.com/t/change-alert-title-url-from-alert-lists-to-panel-url/82892

@olekgo
Copy link

olekgo commented Jul 7, 2023

The solution I described here works for me to customize links, grafana version 9.3.2 but works for grafana 10 too (why wouldn't it work, rendering URL is slack's feature, not grafana's)

Example contact point title is:

<{{ range .Alerts }}{{ .Annotations.dashboard_url }}{{ end }}|  {{ range .Alerts }}{{ .Annotations.summary }}{{ end }}>

With this configured, the alert's title would be of alert's summary annotation, and the link would be of dashboard_url annotation.

As for pointing URL to the exact alert rule, I've not tried it myself but I'd expect it to be possible via the alert's Source attribute

@gtirloni
Copy link

gtirloni commented Jul 27, 2023

The solution I described here works for me to customize links

I appreciate the suggestion but this is a workaround, not a solution. I have to enter that value to each of dozens of contact points and ensure they are not changed when I could simply have a proper centralized notification template that did the right thing.

@jquick
Copy link

jquick commented Aug 11, 2023

This PR addresses the alert-rule link grafana/alerting#109

@michael-sawczuk
Copy link
Author

Now running 10.3 - good to see the slack title does link to the alert rule however orgId is still missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/alerting/notifications Issues when sending alert notifications area/alerting Grafana Alerting area/backend area/templating/repeating Repeating panels or rows effort/medium good first issue Good for newcomers prio/high Must be staffed and worked on either currently, or very soon, ideally in time for the next release. type/bug
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

9 participants