Skip to content

Commit

Permalink
add type check for group names from prom-api
Browse files Browse the repository at this point in the history
  • Loading branch information
xxbbxb committed Feb 26, 2024
1 parent 4f856ed commit d6c0010
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions bot/app/utils/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ def get_rule_from_prom(self, uniqueid: int = None):

try:
for group in self.content['data']['groups']:
if int(group['name']) == self.chat_id:
if group['name'].isnumeric() and int(group['name']) == self.chat_id:
for rule in group['rules']:
if int(rule['labels']['uniqueid']) == uniqueid:
return rule

except KeyError:
return {}

return {}


Expand Down

0 comments on commit d6c0010

Please sign in to comment.