-
Notifications
You must be signed in to change notification settings - Fork 658
feat(alertmanager): support loki alerts GeneratorURL in template functions #6256
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
feat(alertmanager): support loki alerts GeneratorURL in template functions #6256
Conversation
9f10f5b to
dc98078
Compare
|
hello, any thoughts about this ? |
|
hello, no feedback on this ? |
|
Hi @fgouteroux - thanks for the PR. I'm taking a look now. |
|
If I understand right, what we want to accomplish is if the system (e.g. Loki) sending alerts already provide a Grafana Explore URL, then we want to pass that through unchanged. I see the existing functions we have aren't really suitable for this purpose though. If we change I'm not sure the existing functions can satisfy the need for passing through URLs, without breaking someone. So the options might well be:
I'll think on this a little more. |
|
hi, anything I can do to move forward on this PR ? |
|
Hi, any progress on the right direction about this ? |
|
hi @stevesg no chance to purpose a better way ? |
|
I found an other other way to support Loki alerts, I need an additionnal annotation or label and a conditionnal check in alertmanager config. Using a template: then calling it: For Loki, I rewrite the url with adding the from/to range query parameters with alert startAt +/-15min. |
|
@stevesg, maybe you could recheck this 🙏 Reusing Mimir alertmanager for Loki is also super convenient. However, it does not build the URL correctly (due to the different logql syntax?) |
|
@fgouteroux, generatorUrl coming from Loki was not properly encoded, it was fixed by grafana/loki#15601 and should be released with 3.4.0, that should allow to use it? |
|
Thank you for your contribution. This pull request has been marked as stale because it has had no activity in the last 150 days. It will be closed in 30 days if there is no further activity. If you need more time, you can add a comment to the PR. |
|
This pull request has been closed because it has been stale for 30 days with no activity. Feel free to reopen if you want to continue working on this. |
Hello,
We used mimir (v2.10.0) and loki (2.9.1), and the loki ruler is configured to send alerts to mimir alertmanager.
In my mimir alertmanager logs, we got this error since the loki upgrade to 2.9.1:
Before the PR grafana/loki#8500 the loki GeneratorURL was starting with
/graph?g0.exprand now it is/explore?left=, so now we got an error for loki alerts, caused by https://github.com/grafana/mimir/blob/main/pkg/alertmanager/alertmanager_template.go#L68I would like to extend the mimir alertmanager templating function for
grafanaExploreURLandqueryFromGeneratorURLand support the generator url from loki. But I'm not sure that my implementation is the good way, as we can be confused with the alertmanager template function usage like:As it mean that all grafana link will be use the prometheus datasource, except for alerts coming from loki.
Any helps appreciated.
@FUSAKLA as you did a good work with theses functions, maybe you can have a look ?
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]