Skip to content
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 #82096

Closed
wants to merge 6 commits into from

Conversation

cathteng
Copy link
Member

@cathteng cathteng commented Dec 13, 2024

process_workflows is currently called with a GroupEvent for issue types like metric issues to fire downstream actions.

To process issue alerts, we use other elements of PostProcessJob in post_process to evaluate conditions. As such, we should pass PostProcessJob into process_workflows. It contains the GroupEvent.

PostProcessJob is a TypedDict which also has the benefit of allowing us to modify the input without having to refactor stuff that's already in place.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 13, 2024
@cathteng cathteng force-pushed the cathy/aci/process-workflow-kwargs branch from 80a3b78 to 94a8900 Compare December 13, 2024 19:51
Copy link

codecov bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/workflow_engine/processors/workflow.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #82096      +/-   ##
==========================================
- Coverage   80.37%   80.36%   -0.01%     
==========================================
  Files        7277     7277              
  Lines      321488   321487       -1     
  Branches    20966    20966              
==========================================
- Hits       258391   258377      -14     
- Misses      62689    62702      +13     
  Partials      408      408              

@cathteng cathteng changed the title spike(aci): process_workflows with **kwargs for issue alerts spike(aci): pass PostProcessJob into process_workflows Dec 14, 2024
@cathteng cathteng marked this pull request as ready for review December 14, 2024 00:54
@cathteng cathteng requested a review from a team as a code owner December 14, 2024 00:54
@@ -14,11 +14,13 @@


# TODO - cache these by evt.group_id? :thinking:
def get_detector_by_event(evt: GroupEvent) -> Detector:
issue_occurrence = evt.occurrence
def get_detector_by_event(job: PostProcessJob) -> Detector:
Copy link
Member

Choose a reason for hiding this comment

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

nit: get_detector_by_job?

def get_detector_by_event(evt: GroupEvent) -> Detector:
issue_occurrence = evt.occurrence
def get_detector_by_event(job: PostProcessJob) -> Detector:
issue_occurrence = job["event"].occurrence
Copy link
Member

Choose a reason for hiding this comment

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

could be nice to pull this off event = job["event"] since you do that twice

@cathteng cathteng changed the title spike(aci): pass PostProcessJob into process_workflows ref(aci): pass WorkflowJob into process_workflows Dec 20, 2024
@cathteng
Copy link
Member Author

too many merge conflicts, replaced with #82489

@cathteng cathteng closed this Dec 20, 2024
@cathteng cathteng deleted the cathy/aci/process-workflow-kwargs branch December 23, 2024 16:21
@github-actions github-actions bot locked and limited conversation to collaborators Jan 8, 2025
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