question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grafana Webhook Integration: Looks for `tags` in the wrong part of the json payload

See original GitHub issue

Issue 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:

Screen Shot 2019-10-02 at 4 04 09 PM

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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
n0guestcommented, Oct 25, 2019

The thing I’m worried about is that if I need to set a specific environment on an alert it will be more work tagging all individual alert than maintaining a couple of webhook url’s.

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”.

The thing I’m worried about is that if I need to set a specific environment on an alert it will be more work tagging all individual alert than maintaining a couple of webhook url’s.

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?

0reactions
psyhombcommented, Jun 4, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found