Find which feature flag caused your Sentry error spike
When Sentry alerts on a spiking error, we check every recent feature flag change, rank the likely culprits, and post the top suspects to Slack.
When Sentry fires an issue alert for an error that is spiking or has newly regressed, I want an agent to work out whether a recent feature flag change caused it. Trigger this workflow from a Sentry outgoing webhook on issue alerts, and read the issue id, project and organization out of the webhook payload.
Start by building a picture of the error. Use the Sentry "List an Issue's Events" operation to pull recent events for the issue so you have the stack trace, the file paths and function names in it, the affected release, and any tags identifying the service or environment. Use "List Organization Issues" to see the issue in context and establish when the error volume actually started climbing, which is the spike time everything else is measured against. Be precise about that timestamp, because the whole correlation depends on it.
Then look at what changed in LaunchDarkly. Query "List audit log entries" for the 24 hours before the spike started, filtering by that date range, to get every flag change in the window along with who made it and when. Treat each changed flag as a candidate.
For each candidate flag, gather the detail you need to judge it. Use "Get feature flag" to read the flag's name, description and tags, and "Get flag status across environments" to see whether it is currently on in the environment where the error is happening. If an audit entry is ambiguous about what actually changed, use "Get audit log entry" to see the before and after state.
Now rank the candidates by how likely each one is to be the cause. Weigh two things. First, timing overlap: how tightly the flag change lines up with the moment errors began climbing, where a change minutes before the spike matters far more than one twenty hours earlier. Second, relevance: whether the flag key, its description or any of its tags match something in the stack trace, the affected release, or the name of the service that is failing. A flag that scores on both is a strong suspect. A flag that scores on neither should be left off the list rather than padded in. If nothing correlates, say so plainly instead of naming a weak suspect.
Post the result to Slack with "Send a Message" to the on-call channel. Name the top suspects in rank order, and for each one give the flag key, who changed it, when they changed it, what the change was, and whether it is currently on in the affected environment. Explain in one line why each flag is suspected, referencing the timing or the specific stack trace match. Include a link to the Sentry issue and state the recommended kill switch, meaning the exact flag a human should turn off first if they decide to roll back.
If the error volume is above our paging threshold, also open a PagerDuty incident with "Create Incident" and put the same flag analysis in the incident body, so whoever gets paged starts with the suspect list rather than a bare error count. Below that threshold, the Slack message alone is enough.
Never toggle, disable or otherwise modify a feature flag automatically. This workflow only reads from LaunchDarkly and recommends an action. A human must always confirm a production rollback.
What does this prompt do?
- Starts the moment Sentry alerts on a spiking or newly regressed issue, so nobody has to notice it first
- Pulls the error's stack trace, the affected release, and the point in time when the error volume started climbing
- Reviews every feature flag change made in the 24 hours before the spike, including who made it and exactly when
- Ranks the most likely culprits by timing and by whether the flag name, description or tags match the failing code, then posts a shortlist to Slack with the recommended kill switch and a link to the issue
- Opens a PagerDuty incident carrying the same analysis when error volume crosses your paging threshold
What do I need to use this?
- A Sentry account with issue alerts turned on for the projects you care about
- A LaunchDarkly account. The workflow only reads your flags and their change history, it never edits them
- A Slack workspace and a channel where on-call should be notified
- A PagerDuty account, only if you want the automatic paging step
How can I customize it?
- Change the lookback window for flag changes, which defaults to the 24 hours before the spike started
- Set the error volume that justifies paging someone, or switch the PagerDuty step off entirely
- Choose which Slack channel gets the alert and which LaunchDarkly project and environments are searched
- Adjust how much weight the ranking gives to timing versus keyword matches against the stack trace
FAQs
Will this turn the feature flag off automatically?
What happens if no flag change actually caused the error?
How does it decide which flag is the most likely culprit?
Do I need PagerDuty for this to be useful?
How quickly does it run after an error spikes?
Related templates
When your flight moves, your calendar times get corrected automatically and you get a Slack note naming the meetings you're about to miss.
Every 15 minutes, forwarded phishing reports get traced back to the server that really sent them, with a verdict in Slack and the worst senders reported.
Every weekday at 7am, sign in to the tender portals you track, filter new notices against your bid criteria, and open a deal for the ones worth chasing.
Every Monday, rank the week's matches by expected demand, put the big ones on your venue calendar, and post a rota-ready summary to Slack.
Every Tuesday we pull your best new reviews, draft social captions, email testimonials and product page quotes, then stage them in Notion for approval.
Every weekday morning, unfulfilled orders get an address check: harmless typos fixed automatically, risky addresses held with a note to the customer.
Stop guessing which flag broke production.
Get the shortlist of suspect feature flags, and the name of who changed them, in Slack before your on-call engineer even opens the dashboard.