Grafana Webhook Integration: Looks for `tags` in the wrong part of the json payload
See original GitHub issueIssue Summary Grafana webhook doesn’t convert the tags sent by Grafana into custom attributes. This appears to be because in Grafana.py, it’s looking in the wrong part of the incoming json document for the tags.
Here’s the incoming alert payload from Grafana version 6.3.6, which is the newest version:
{
"evalMatches":[
{
"value":323.4,
"metric":"samples",
"tags":{
}
}
],
"message":"Here's my message",
"ruleId":12,
"ruleName":"Samples Appended alert",
"ruleUrl":"http://grafana.monitor.aort.<...>.com/d/itBdm3dZz/prometheus-health?fullscreen\\u0026edit\\u0026tab=alert\\u0026panelId=3\\u0026orgId=1",
"state":"alerting",
"tags":{
"arbitrary_key":"arbitrary_val",
"dashboard":"my dashboard",
"slack":"my_slack",
"tsg":"my tsg"
},
"title":"[Alerting] Samples Appended alert"
}
Here’s the Grafana alert config:
In Alerta’s grafana code (https://github.com/alerta/alerta/blob/master/alerta/webhooks/grafana.py#L33) it appears to be building custom attributes from the tag data from some match
stanza rather than the top-level tags
stanza where the sent tags are actually located.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:11 (10 by maintainers)
Top Results From Across the Web
Tags in alert webhook payload not as specified in Alert ...
What happened: i specified some tags in an alert using the 'Tags' section in the notification. then i triggered the alert. then i...
Read more >Rulesets - PagerDuty Knowledge Base
The Rulesets feature allows you to route events to an endpoint and create collections of event rules, which define sets of actions to...
Read more >23. Notifications — Ansible Tower User Guide v3.8.6
Notification types supported with Ansible Tower: Email. Grafana. HipChat. IRC. Mattermost. PagerDuty. Rocket.Chat. Slack. Twilio. Webhook. Webhook payloads.
Read more >API Docs - GitLab Docs
The API uses JSON to serialize data. You don't need to specify .json at the end of the API URL. In the ...
Read more >Webhook Source: Distribute Alert Messages from Grafana
Before we can set up the alerts and notification channel in Grafana, ... here as well as different tags, both of which are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, it’s “the other side of the coin”. By combining both ways we’re providing end users a choice how to use it in their own specific case. The only consequence of such decision - complexity of logic in code. But as they say - “there is always a trade off”.
As I wrote above, having both scenarios will allow you or anyone else to use the “better” for them - by handling the list of URL’s (with overrided params as query args) or by specifying addition custom tags in specific alert at Grafana (to override the same params).
So, @satterly, what do you think on that matter?
I’ve created a PR to address this issue ⬆️, so @satterly when you find time could you please review it and see if there is anything else that has to be done.
Thanks