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

feat(crons): Implement simple incident occurence dispatching #80773

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

evanpurkhiser
Copy link
Member

Simply deserializes the IncidentOccurrence messages and dispatches the
incident occurrence.

Does not yet determine if the clock tick should cause the dispatch to be
delayed.

@evanpurkhiser evanpurkhiser requested a review from a team as a code owner November 14, 2024 20:38
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 14, 2024
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-crons-implement-simple-incident-occurence-dispatching branch from ba25e24 to 4f02b73 Compare November 14, 2024 20:48
Simply deserializes the IncidentOccurrence messages and dispatches the
incident occurrence.

Does not yet determine if the clock tick should cause the dispatch to be
delayed.
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-crons-implement-simple-incident-occurence-dispatching branch from 4f02b73 to cc1b540 Compare November 14, 2024 21:01
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 5 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...onitors/consumers/incident_occurrences_consumer.py 75.00% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #80773      +/-   ##
==========================================
- Coverage   78.39%   78.39%   -0.01%     
==========================================
  Files        7206     7206              
  Lines      319438   319458      +20     
  Branches    43991    43992       +1     
==========================================
+ Hits       250437   250449      +12     
- Misses      62620    62626       +6     
- Partials     6381     6383       +2     

def has_all(checkins: list[MonitorCheckIn | None]) -> TypeGuard[list[MonitorCheckIn]]:
return None not in checkins

# Unlikeky, but if we can't find all the check-ins we can't produce an occurence
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Unlikeky, but if we can't find all the check-ins we can't produce an occurence
# Unlikely, but if we can't find all the check-ins we can't produce an occurence

try:
incident = MonitorIncident.objects.get(id=int(wrapper["incident_id"]))
except MonitorIncident.DoesNotExist:
return
Copy link
Member

Choose a reason for hiding this comment

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

worth adding a test case for this?


# Unlikeky, but if we can't find all the check-ins we can't produce an occurence
if failed_checkin is None or not has_all(previous_checkins):
logger.error("missing_check_ins")
Copy link
Member

Choose a reason for hiding this comment

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

worth adding a test case for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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