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

IndexError: list index out of range in aggregaterule plugin #25

Open
rudexi opened this issue Apr 21, 2022 · 0 comments
Open

IndexError: list index out of range in aggregaterule plugin #25

rudexi opened this issue Apr 21, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@rudexi
Copy link

rudexi commented Apr 21, 2022

The following error sometimes happen:

2022-04-20 11:16:24,630 snooze               ERROR    list index out of range
Traceback (most recent call last):
  File "/opt/snooze/lib/python3.6/site-packages/snooze/core.py", line 125, in process_record
    record = plugin.process(record)
  File "/opt/snooze/lib/python3.6/site-packages/snooze/plugins/core/aggregaterule/plugin.py", line 34, in process
    record = self.match_aggregate(record, aggrule.throttle, aggrule.flapping, aggrule.watch, aggrule.name)
  File "/opt/snooze/lib/python3.6/site-packages/snooze/plugins/core/aggregaterule/plugin.py", line 60, in match_aggregate
    aggregate = aggregate_result['data'][0]
IndexError: list index out of range

https://github.com/snoozeweb/snooze/blob/v1.4.0/snooze/plugins/core/aggregaterule/plugin.py#L60

We're in a situation where Database.search() returns a dict with a data and a count that do not correspond to each other.
Maybe it's better to drop that count. Both python and javascript can access an array length in a cheap manner.

@rudexi rudexi added the bug Something isn't working label Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant