-
Notifications
You must be signed in to change notification settings - Fork 291
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
Show 100000+ in stats when there are more than 100000 alert groups in the result #1901
Conversation
engine/apps/api/views/alert_group.py
Outdated
@@ -398,20 +398,14 @@ def enrich(self, alert_groups): | |||
|
|||
@action(detail=False) | |||
def stats(self, *args, **kwargs): | |||
alert_groups = self.filter_queryset(self.get_queryset()) | |||
# Only count field is used, other fields left just in case for the backward compatibility | |||
MAX_COUNT = 1001 |
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.
TODO: define this number
# Only count field is used, other fields left just in case for the backward compatibility | ||
MAX_COUNT = 1001 | ||
alert_groups = self.filter_queryset(self.get_queryset())[:MAX_COUNT] | ||
count = alert_groups.count() |
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.
TODO: check if we need to use len() here
"count": alert_groups.filter().count(), | ||
"count_previous_same_period": 0, | ||
"alert_group_rate_to_previous_same_period": 1, | ||
"count_escalations": 0, | ||
"count_escalations_previous_same_period": 0, | ||
"escalation_rate_to_previous_same_period": 1, | ||
"average_response_time": None, | ||
"average_response_time_to_previous_same_period": None, | ||
"average_response_time_rate_to_previous_same_period": 0, | ||
"prev_period_in_days": 1, |
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.
👍
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.
Niiiice
engine/apps/api/views/alert_group.py
Outdated
MAX_COUNT = 1001 | ||
alert_groups = self.filter_queryset(self.get_queryset())[:MAX_COUNT] | ||
count = alert_groups.count() | ||
print(count) |
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.
print
statement
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
What this PR does
Which issue(s) this PR fixes
Checklist
pr:no public docs
PR label added if not required)CHANGELOG.md
updated (orpr:no changelog
PR label added if not required)