Skip to content

Commit

Permalink
Filter for sent/error
Browse files Browse the repository at this point in the history
When debugging, it is often very useful to be able to filter to just
alerts that had an error or did not match any existing rules
  • Loading branch information
kfdm committed Aug 1, 2023
1 parent 49dda83 commit 39acbb2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions promgen/templates/promgen/alert_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<th>Service</th>
<th>Project</th>
<th>Job</th>
<th>Sent</th>
<th>Error</th>
<th><a href="?noSent=1">Sent</a></th>
<th><a href="?sentError=1">Error</a></th>
</tr>
{% for alert in alert_list %}
<tr>
Expand Down
7 changes: 6 additions & 1 deletion promgen/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,12 @@ def get_queryset(self):
for key, value in self.request.GET.items():
if key in ["page", "search"]:
continue
qs = qs.filter(alertlabel__name=key, alertlabel__value=value)
elif key == "noSent":
qs = qs.filter(sent_count=0)
elif key == "sentError":
qs = qs.exclude(error_count=0)
else:
qs = qs.filter(alertlabel__name=key, alertlabel__value=value)
return qs


Expand Down

0 comments on commit 39acbb2

Please sign in to comment.