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

Statistics never reset path_total value #2331

Closed
kamil-certat opened this issue Mar 9, 2023 · 0 comments · Fixed by #2332
Closed

Statistics never reset path_total value #2331

kamil-certat opened this issue Mar 9, 2023 · 0 comments · Fixed by #2332
Labels
bug Indicates an unexpected problem or unintended behavior component: core

Comments

@kamil-certat
Copy link
Contributor

kamil-certat commented Mar 9, 2023

IntelMQ built-in statistics feature works in the way, that after every restart of the bot, statistics are considered to be counted from 0 (code).

The statistics cache is updated in __stats method. Successful and failure stats are sent every time (with the respect to the delay), however the number of sent messages (lines 472-474) is updated only when a message was sent - paths are never filled with 0, the defaultdict is used. This means, that from the restart to the first sent message, the Redis statistic cache and IntelMQ message counter are out of sync.

Why is it important?

I have a case with daily restarted collector that produces just a one message daily. Due to the described behavior, the cached stats are always filed with 1 - either because it wasn't updated, or because the first message was sent.

@kamil-certat kamil-certat changed the title Statistics never resets path_total value Statistics never reset path_total value Mar 9, 2023
@sebix sebix added bug Indicates an unexpected problem or unintended behavior component: core labels Mar 9, 2023
kamil-certat added a commit to kamil-certat/intelmq that referenced this issue Mar 9, 2023
After restarting a bot, ensure that statistics about sent
messages are zeroes in the stats cache. Previously, it
was done after the first message to a path. Before this,
the internal counter and stats cache were out of sync.

Fixes certtools#2331
kamil-certat added a commit to kamil-certat/intelmq that referenced this issue Mar 9, 2023
After restarting a bot, ensure that statistics about sent
messages are zeroes in the stats cache. Previously, it
was done after the first message to a path. Before this,
the internal counter and stats cache were out of sync.

Fixes certtools#2331
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior component: core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants