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(escalating-issues): Update cron task to use nodestore #47496

Merged
merged 6 commits into from
Apr 18, 2023

Conversation

jangjodi
Copy link
Member

Update escalating issues forecast cron task to use nodestore instead of GroupForecast

WOR-2968

@jangjodi jangjodi requested review from a team and removed request for a team April 17, 2023 21:18
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 17, 2023
@jangjodi jangjodi requested a review from a team April 17, 2023 21:18
@codecov
Copy link

codecov bot commented Apr 17, 2023

Codecov Report

Merging #47496 (fe0bd02) into master (3c49f00) will increase coverage by 16.80%.
The diff coverage is 100.00%.

❗ Current head fe0bd02 differs from pull request most recent head 5dafe5b. Consider uploading reports for the commit 5dafe5b to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #47496       +/-   ##
===========================================
+ Coverage   63.78%   80.59%   +16.80%     
===========================================
  Files        4729     4762       +33     
  Lines      200896   201431      +535     
  Branches    11618    11626        +8     
===========================================
+ Hits       128144   162341    +34197     
+ Misses      72496    38832    -33664     
- Partials      256      258        +2     
Impacted Files Coverage Δ
src/sentry/issues/escalating_group_forecast.py 100.00% <100.00%> (ø)
src/sentry/tasks/weekly_escalating_forecast.py 97.82% <100.00%> (+57.47%) ⬆️

... and 1430 files with indirect coverage changes

Copy link
Member

@armenzg armenzg left a comment

Choose a reason for hiding this comment

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

This is looking good! Few minor changes.

src/sentry/issues/escalating_group_forecast.py Outdated Show resolved Hide resolved
src/sentry/issues/escalating_group_forecast.py Outdated Show resolved Hide resolved
src/sentry/issues/escalating_group_forecast.py Outdated Show resolved Hide resolved
escalating_group_forecast.save()


def get_forecasts(groups: List[Group]) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

This function will be called by Snigdha's PR, thus, I would like to decouple it from the weekly task module.

Could you please open a new PR moving this function and save_forecast_per_group to src/sentry/issues/escalating.py? (I believe that's a good centralized place) or even src/sentry/issues/forecasts.py if it makes more sense. Feel free to propose a better location.

Copy link
Member Author

@jangjodi jangjodi Apr 18, 2023

Choose a reason for hiding this comment

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

Thank you for the suggestion, here's the PR

fetched_forecast = EscalatingGroupForecast.fetch(group_list[0].project.id, group_list[0].id)
assert fetched_forecast.project_id == group_list[0].project.id
assert fetched_forecast.group_id == group_list[0].id
assert fetched_forecast.forecast == FORECAST_LIST_MOCK
Copy link
Member

Choose a reason for hiding this comment

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

I'm all confused. Why is the forecast 14 times the number 200?

Copy link
Member Author

Choose a reason for hiding this comment

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

The forecast is [200] * 14 because I didn't add a lot of data from the past week in the tests, and it defaults to 200 when this happens (see here). I figured the tests for the algorithm itself should suffice to actually test the forecast values

Copy link
Member

Choose a reason for hiding this comment

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

Okay. This is low end forecast. Thank you for clarifying.


# Assert no duplicates when this is run twice
# Assert update when this is run twice
Copy link
Member

Choose a reason for hiding this comment

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

This is probably fine, however, we should have it in mind if re-runs of the tasks happened often and we wanted the re-runs to be faster.

jangjodi and others added 2 commits April 18, 2023 09:50
Co-authored-by: Armen Zambrano G. <armenzg@sentry.io>
Copy link
Member

@armenzg armenzg left a comment

Choose a reason for hiding this comment

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

Fantastic! 🎉

@jangjodi jangjodi merged commit 249acba into master Apr 18, 2023
@jangjodi jangjodi deleted the jodi/wor-2968 branch April 18, 2023 20:18
@armenzg armenzg added this to the Escalating Issues V1 milestone Apr 25, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 11, 2023
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