Skip to main content

Context

When a Sentry metric alert fires, the webhook Sentry sends may not include the settings configured on the alert rule that triggered it. One of those settings is the Alert source, which we use to route the alert to your Sentry Metrics alert source. This is caused by a recent change on Sentry’s side, which we have raised as an issue with Sentry. Until then, you can work around it by sending the webhook to a Custom HTTP alert source through a Sentry internal integration.

Workaround

There are three parts to this: create a Custom HTTP source in incident.io, create an internal integration in Sentry, then update your metric monitor to notify that integration.

1. Create a Custom HTTP alert source

In incident.io, go to your alert source configuration and create a new Custom HTTP alert source. See Custom HTTP alert sources for more detail on this source type.
  1. Add a JavaScript transform expression. This transforms the event_alert webhook, that Sentry sends from a Metric Monitor, into incident.io’s alert schema:
    JavaScript expressions panel in incident.io showing the transform expression and deduplication key path
  2. Set the Deduplication key path to $.data.event.event_id.
  3. Make a note of the Query authentication URL, then Save. You’ll need the URL in the next step.
  4. Save your changes.
  5. You can use the properties in the transform expression to map to alert attributes with alert attributes expressions.

2. Create an internal integration in Sentry

In Sentry, go to Settings → Custom Integrations (https://<your-subdomain>.sentry.io/settings/developer-settings/).
  1. Select Create New Integration. Sentry Custom Integrations page with the Create New Integration button
  2. Choose Internal Integration, then select Next. Choose Integration Type dialog with Internal Integration selected
  3. Configure the integration:
    • Name: something easy to identify, for example “Notify incident.io (with webhook)”
    • Webhook URL: paste the Query authentication URL from step 1
    • Alert Rule Action: enable this so the integration is available on alert rules
    • You don’t need to configure any other fields.
    Internal integration details showing name, webhook URL, and Alert Rule Action enabled
  4. Select Save changes.

3. Update your metric monitor’s connected alerts

Now point the metric monitor that uses your Sentry Metrics alert source at the integration you just created.
  1. Open the metric monitor you’re currently using with your Sentry Metrics alert source.
  2. Scroll to Connected Alerts and select Edit Alerts. Connected Alerts panel with the Edit Alerts button
  3. Edit the connected alert that notifies incident.io. Alert rule editor showing the action that notifies incident.io
  4. Select add an action, then scroll down and choose Send a notification via an integration. Other integrations section with the Send a notification via an integration option
  5. Select the integration you created in step 2, then Save. Send a notification via the new integration, with a warning that the action will not fire for metric issues
    • Sentry shows a “This action will not fire for metric issues” message next to this action, but you can ignore it. This is a known Sentry bug.
Sentry now sends event alert webhooks to your Custom HTTP source in incident.io.
Sentry only sends this webhook when a metric alert is triggered, not when it resolves. Alerts created through this source won’t resolve automatically when the Sentry alert recovers, so you’ll need to resolve them in incident.io.