Skip to content

feat(notifications): Add notification data and renderer for metric alerts#111674

Merged
Christinarlong merged 16 commits into
masterfrom
crl/meetric-alert-data
Mar 30, 2026
Merged

feat(notifications): Add notification data and renderer for metric alerts#111674
Christinarlong merged 16 commits into
masterfrom
crl/meetric-alert-data

Conversation

@Christinarlong

Copy link
Copy Markdown
Contributor

This PR adds the notification data, template and renderer for metric alerts. Next PR will be wiring this to the notification platform.

The general structure for metric alerts is very, make a bunch of dataclasses/context objs from the given models and then call the builders from that. So for the data we're sending down reference ids to be re fetched and serializing any context objects (that don't have complex models in them) to save on DB queries.

  • Note that because currently the whole metric issue process is synchronous, notificationdata being a BaseModel is a bit of an anti pattern since we have to requery a bunch of models.

Like issue alerts, the SlackMetricAlertRenderer is a bit of a pass through layer to then call into the SlackIncidentsMessageBuilder so we do a dummy template.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 26, 2026
@Christinarlong Christinarlong marked this pull request as ready for review March 26, 2026 20:24
@Christinarlong Christinarlong requested review from a team as code owners March 26, 2026 20:24
Comment thread src/sentry/notifications/platform/slack/renderers/metric_alert.py Outdated
Comment thread tests/sentry/notifications/platform/templates/test_metric_alert.py Outdated
@github-actions

This comment was marked as outdated.

Comment thread src/sentry/notifications/platform/templates/metric_alert.py Outdated
Comment thread src/sentry/notifications/platform/slack/renderers/metric_alert.py
Comment thread src/sentry/notifications/platform/slack/renderers/metric_alert.py Outdated
Comment thread src/sentry/notifications/platform/templates/metric_alert.py Outdated
Comment thread src/sentry/notifications/platform/templates/metric_alert.py Outdated
Comment thread src/sentry/notifications/platform/slack/renderers/metric_alert.py
@github-actions

This comment was marked as outdated.

Comment thread src/sentry/notifications/platform/slack/renderers/metric_alert.py
Comment thread src/sentry/notifications/platform/slack/renderers/metric_alert.py
@github-actions

This comment was marked as outdated.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread src/sentry/incidents/typings/metric_detector.py
@Christinarlong Christinarlong merged commit d75c5c5 into master Mar 30, 2026
69 checks passed
@Christinarlong Christinarlong deleted the crl/meetric-alert-data branch March 30, 2026 23:19
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants