-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(pagerduty): Issue alerts will include alert name in summary #87786
Conversation
@@ -58,7 +59,7 @@ def post(self, request: Request, project) -> Response: | |||
"frequency": 30, | |||
} | |||
) | |||
rule = Rule(id=-1, project=project, data=data) | |||
rule = Rule(id=-1, project=project, data=data, label=data.get("name")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rules are invalid without a label, so I feel comfortable including this across the board.
@@ -90,6 +91,12 @@ def send_notification(event, futures): | |||
severity=severity, | |||
) | |||
|
|||
rules: list[Rule] = [f.rule for f in futures] | |||
rule = rules[0] if rules else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious if u know why u need to do rules[0]
could we ever pass more than one thing inside rules
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rules
is a list of Rule
objects, and they are all identical as per https://github.com/getsentry/sentry/blob/master/src/sentry/rules/processing/processor.py#L178-L186, but this pattern is also used in a bunch of other EventAction's so if someone violated this, many tests would break. Weird pattern though, I agree -- im sure there's a historic reason.
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #87786 +/- ##
=======================================
Coverage 87.74% 87.74%
=======================================
Files 9897 9897
Lines 561841 561879 +38
Branches 22142 22142
=======================================
+ Hits 492964 493009 +45
+ Misses 68475 68468 -7
Partials 402 402 |
Some notifications may change their content depending on the title of the alert. This is the case for PagerDuty as per the change in #87786. For users to better understand what they can expect when using the test notification button, if they've set up an alert name we should use it, that way it'll appear in the test notification as well. If the user is setting up an issue alert for the first time, the test notification will use the label `Test Alert` (per the change here #87786 -- not included in this PR)
) For issue alerts that include a pagerduty notification action, the name of the alert rule will be included in the title. Also ensures test notifications have a label and can include one from the alert. This will enable users to see what the actual Pagerduty Incident title will be from the `Send Test Notification` button. If they are setting up a notif for the first time and haven't added a name `Test Alert` will be used instead. Will require a followup FE PR to send the notif title along with the preview alert payload. <img width="1402" alt="image" src="https://github.com/user-attachments/assets/fb481f48-03c5-4213-93fb-d2c6293f0617" /> **todo** - [x] Add screenshots - [x] Add tests
Some notifications may change their content depending on the title of the alert. This is the case for PagerDuty as per the change in #87786. For users to better understand what they can expect when using the test notification button, if they've set up an alert name we should use it, that way it'll appear in the test notification as well. If the user is setting up an issue alert for the first time, the test notification will use the label `Test Alert` (per the change here #87786 -- not included in this PR)
For issue alerts that include a pagerduty notification action, the name of the alert rule will be included in the title.
Also ensures test notifications have a label and can include one from the alert. This will enable users to see what the actual Pagerduty Incident title will be from the
Send Test Notification
button. If they are setting up a notif for the first time and haven't added a nameTest Alert
will be used instead.Will require a followup FE PR to send the notif title along with the preview alert payload.
todo