Grafana 8.3.3 Test alert notifications showing incorrect ruleID

We recently migrated from Grafana 6.7.4 to Grafana 8.3.3. We are using our own webhook for notification channel as we enrich the alerts from Grafana with some meta information before passing to Opsgenie. We noticed that with Grafana 6.7.4 the webhook test notification setting used to test if notification channel is fine generated the below JSON payload

{
  dashboardId: 1,
  evalMatches: [
    { value: 100, metric: 'High value', tags: null },
    { value: 200, metric: 'Higher Value', tags: null }
  ],
  message: 'Someone is testing the alert notification within Grafana.',
  orgId: 0,
  panelId: 1,
  ruleId: 0,
  ruleName: 'Test notification',
  ruleUrl: 'http://grafana.staged-by-discourse.com/',
  state: 'alerting',
  tags: {},
  title: '[Alerting] Test notification'
}

While handling this payload we used condition of ruleID = 0 as test notification and ignore it. Post migrating to Grafana 8.3.3 we see this payload is changed to something like:


{
    "title": "[Alerting] Test notification",
    "ruleId": 1559729022103063253,
    "ruleName": "Test notification",
    "state": "alerting",
    "evalMatches": [
        {
            "value": 100,
            "metric": "High value",
            "tags": null
        },
        {
            "value": 200,
            "metric": "Higher Value",
            "tags": null
        }
    ],
    "orgId": 0,
    "dashboardId": 1,
    "panelId": 1,
    "tags": {},
    "ruleUrl": "https://grafana.xxxxxxxxx.com/",
    "message": "Someone is testing the alert notification within Grafana."
}

The value of ruleID is not consistent & it keeps throwing random values. Is this expected behaviour? How can we uniquely identify this alert for testing of alert notification?
Note: We don’t have the unified alerting or opt-in features enabled for 8.3.3

welcome to the :grafana: forum, @aloksave

The "Unified Alerting is a complete rebuild of the alerting platform, and much more performant. It will be the future of alerting, so might be best to transition to Unified and then see how the ruleId behaves?

Thanks @mattabrams.
We were able to trace this back to Opsgenie Notification Channel "Test" always uses "alias" value of "alertId-0" (which makes alerts hard to find) · Issue #31832 · grafana/grafana · GitHub, the ruleID was changed to generate a random id instead of the default behaviour of 0. Change was pushed through Alerting: Generate random id by ldhnam · Pull Request #31844 · grafana/grafana · GitHub

1 Like