-
-
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(ACI): Generate Workflow names based on actions #87256
Conversation
from sentry.models.team import Team | ||
from sentry.users.services.user import RpcUser | ||
|
||
MAX_CHARS = 248 # (256 minus space for '...(+3_)') |
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.
do we have a limit for Action
s on a Workflow
? if it's possible to be higher than 99 actions I'll have to change this
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.
you could do something like (99+) if there are more?
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.
oh I like that idea 👍
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.
There's no limit on the number of actions / workflows. I'd honestly just cap it to the first 3 actions and append ...
though, beyond that and it won't be super useful.
MAX_CHARS = 248 # (256 minus space for '...(+3_)') | ||
|
||
|
||
def get_action_description(action: AlertRuleTriggerAction) -> str: |
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.
I based this off of https://github.com/getsentry/sentry/blob/master/src/sentry/incidents/endpoints/serializers/alert_rule_trigger_action.py#L9-L9 didn't seem worth it to refactor to use both since a) we'll be getting rid of the serializer and b) I changed all the text
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.
Some of these read a little strangely like "PagerDuty to #my-team" but I was shortening it from "Send a {priority} PagerDuty notification to {target_display}"
, very open to other ideas for these! "Slack #michelle" rolls off the tongue a lot nicer than some of these
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.
Notify {target_display} via {notification_type}
? for something super generic you can keep reusing
""" | ||
name = "" | ||
triggers = AlertRuleTrigger.objects.filter(alert_rule_id=alert_rule.id).order_by("label") | ||
include_label = False if triggers.count() == 1 else True |
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.
This makes it so that if there is only one trigger we don't bother with adding the prefix like "Critical - Slack #hb-bets" since there is only one trigger it feels a bit redundant
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.
lgtm 🎉
❌ 3 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
We want to name workflows something meaningful and descriptive that isn't the same thing as the detector name. This PR builds the workflow name based on the action text so the name will be like "Email colleen@sentry.io".