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

fix: Add alerts_count, affected_services and sources fields to the Incident #1473

Conversation

VladimirFilonov
Copy link
Contributor

Add alerts_count, affected_services and sources fields to the Incident and pre-population logic for them on adding alerts to the incident

Closes #1472

📑 Description

The incidents list page performed poorly when there were a large number of alerts in the incidents. That happened because alerts count, affected services and sources were calculated in runtime.

This PR changes this behavior to pre-calculated data for incidents

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

Copy link

vercel bot commented Jul 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
keep ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 8, 2024 8:24am

@VladimirFilonov VladimirFilonov changed the title Add alerts_count, affected_services and sources fields to the Incident fix: Add alerts_count, affected_services and sources fields to the Incident Jul 26, 2024
@VladimirFilonov VladimirFilonov force-pushed the fix/1472-poor-performance-of-incidents-list-with-large-amount-of-alerts branch from 84725df to 8e52fa4 Compare July 26, 2024 15:39
keep/api/core/db.py Outdated Show resolved Hide resolved
keep/api/core/db.py Outdated Show resolved Hide resolved
Copy link
Member

@talboren talboren left a comment

Choose a reason for hiding this comment

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

I have a few comments, mostly around dialect specific SQL functions that could be problematic in the future (or even now).
Maybe the ideal case here is to have some worker doing those calcs in the background? just thinking out loud, idk.

@VladimirFilonov VladimirFilonov force-pushed the fix/1472-poor-performance-of-incidents-list-with-large-amount-of-alerts branch from fc36449 to 5d08733 Compare July 30, 2024 09:58
@VladimirFilonov VladimirFilonov force-pushed the fix/1472-poor-performance-of-incidents-list-with-large-amount-of-alerts branch from 5d08733 to 2388a89 Compare July 31, 2024 10:59
@VladimirFilonov VladimirFilonov requested a review from talboren July 31, 2024 11:26
Copy link

codecov bot commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 21.21212% with 52 lines in your changes missing coverage. Please review.

Project coverage is 37.36%. Comparing base (c0be6a5) to head (b8e5f12).
Report is 6 commits behind head on main.

Files Patch % Lines
keep/api/core/db.py 10.81% 33 Missing ⚠️
tests/conftest.py 17.64% 14 Missing ⚠️
keep/api/core/db_utils.py 28.57% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1473       +/-   ##
===========================================
- Coverage   68.38%   37.36%   -31.03%     
===========================================
  Files         112       28       -84     
  Lines        9288     2671     -6617     
===========================================
- Hits         6352      998     -5354     
+ Misses       2936     1673     -1263     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@talboren talboren left a comment

Choose a reason for hiding this comment

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

LGTM!

@Matvey-Kuk Matvey-Kuk merged commit 1ea44bf into main Aug 8, 2024
7 of 11 checks passed
@Matvey-Kuk Matvey-Kuk deleted the fix/1472-poor-performance-of-incidents-list-with-large-amount-of-alerts branch August 8, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Poor performance of Incidents list with large amount of alerts
3 participants