-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ref(aci): pass WorkflowJob into process_workflows #82489
Conversation
# PostProcessJob event is optional, WorkflowJob event is required | ||
if "event" not in job: | ||
logger.error("Missing event to create WorkflowJob", extra={"job": job}) | ||
return | ||
|
||
try: | ||
workflow_job = WorkflowJob({**job}) # type: ignore[typeddict-item] | ||
except Exception: | ||
logger.exception("Could not create WorkflowJob", extra={"job": job}) | ||
return |
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.
couldn't make mypy happy with this, it kept complaining the event
didn't exist
class EventJob(TypedDict): | ||
event: GroupEvent | ||
|
||
|
||
class WorkflowJob(EventJob, total=False): | ||
group_state: GroupState | ||
is_reprocessed: bool | ||
has_reappeared: bool | ||
has_alert: bool | ||
has_escalated: bool | ||
|
||
|
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.
the main piece of this PR
if state is None: | ||
return False | ||
|
||
return state["is_regression"] == comparison |
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.
is is_regression
guaranteed to exist on state
? if not I'd do a .get()
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.
yes it's guaranteed, the state is a typed dict too
sentry/src/sentry/eventstream/base.py
Lines 30 to 34 in a62dc3b
class GroupState(TypedDict): | |
id: int | |
is_new: bool | |
is_regression: bool | |
is_new_group_environment: bool |
Original PR #82096
process_workflows
is currently called with aGroupEvent
for issue types like metric issues to fire downstream actions.To process issue alerts, we use other elements of
PostProcessJob
inpost_process
to evaluate conditions. As such, we should pass a version ofPostProcessJob
(here calledWorkflowJob
) intoprocess_workflows
. It contains a requiredGroupEvent
and then makes everything else fromPostProcessJob
optional.