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

ruleURL should open the alert rule page and not list the rules, previously it used to open the dashboard #96

Open
panikdkernel opened this issue May 9, 2023 · 8 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@panikdkernel
Copy link

https://github.com/grafana/alerting/blob/793c67215ba14d6515b93707caeb7e6d9bf82189/receivers/slack/slack.go#LL290C90-L290C90

@armandgrillet armandgrillet added the bug Something isn't working label May 9, 2023
@yuri-tceretian
Copy link
Contributor

This seems to have been done intentionally at the beginning of unified alerting grafana/grafana#33739. In legacy alerting it points to the dashboard panel https://github.com/grafana/grafana/blob/40feee0d17c72421bfd0e9dc5deebc83f7e3bb68/pkg/services/alerting/notifiers/slack.go#L212

@panikdkernel
Copy link
Author

panikdkernel commented May 9, 2023

Is there a way to pass it as a config var ? Maybe Something like slackTitleURL or can we modify this behaviour using notifications templates?

@yuri-tceretian
Copy link
Contributor

The reason for that behavior is that unified alerting notification component (Alertmanager) supports grouping alerts by labels, and therefore integration can receive multiple alerts

func (sn *Notifier) createSlackMessage(ctx context.Context, alerts []*types.Alert) (*slackMessage, error) {
var tmplErr error
tmpl, _ := templates.TmplText(ctx, sn.tmpl, alerts, sn.log, &tmplErr)
ruleURL := receivers.JoinURLPath(sn.tmpl.ExternalURL.String(), "/alerting/list", sn.log)

Therefore, it is not clear to which alert rule the slack message should refer to.

@yuri-tceretian
Copy link
Contributor

yuri-tceretian commented May 9, 2023

Is there a way to pass it as a config var ?

Unfortunately, I do not see any way you can change that URL. We can make it configurable, though and use the current behavior as the default.

Alternative is to check if there is one alert in the group and create proper URL to the rule

@panikdkernel
Copy link
Author

Alternative is to check if there is one alert in the group and create proper URL to the rule

Yes, currently we have single alert in the group as we migrated from the legacy alerts

I tried grouping the alerts using group overrides in notifications policy and now ruleURL value does make sense, the only way currently I see to access alert is through notification templates

Though it would be really handy if we could also config slack title url.

@yuri-tceretian yuri-tceretian added enhancement New feature or request good first issue Good for newcomers and removed bug Something isn't working labels May 11, 2023
@jquick
Copy link
Contributor

jquick commented Jun 20, 2023

I also ran into this. We currently have all our slack alerts ungrouped so this would be amazing!

@jquick
Copy link
Contributor

jquick commented Jun 20, 2023

There is a work around for this. If you format a title in the slack link format:

<https://myLink|myTitle>

It will override the titleLink sent with the payload on slack. You can use a template to generate this just make sure you do not have any newlines.

@armandgrillet
Copy link
Contributor

This is done for Slack but might happen for other messages, leaving this issue open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: Backlog
Development

No branches or pull requests

4 participants