-
-
Notifications
You must be signed in to change notification settings - Fork 136
[fix] Don't evaluate threshold for historical data #666 #669
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
Conversation
13157b9
to
85f17fe
Compare
""" | ||
if not time or not isinstance(time, datetime): | ||
raise ValueError('Invalid time value') | ||
recent_time = timezone.now() - timedelta(minutes=60) |
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.
I have chosen 1 hour arbitrarily. We can change this if needed.
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.
I argue that anything older than 5 minutes shouldn't trigger the check of the threshold, because it could come after more recent data has already been ingested and could conflict with recent data, hence generating inconsistent results.
Data older than 1 hour is considered historical data. | ||
""" | ||
if not time or not isinstance(time, datetime): | ||
raise ValueError('Invalid time value') |
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.
this shouldn't happen right? If we flag the method as private I think we can save these 2 lines of code as this method is going to be used only internally.
""" | ||
if not time or not isinstance(time, datetime): | ||
raise ValueError('Invalid time value') | ||
recent_time = timezone.now() - timedelta(minutes=60) |
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.
I argue that anything older than 5 minutes shouldn't trigger the check of the threshold, because it could come after more recent data has already been ingested and could conflict with recent data, hence generating inconsistent results.
bb89f26
to
cc3de48
Compare
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.
Changes discussed:
- We could move the logic which check whether we're dealing with fresh or old data before the metric is being written, so that if it's historical data we could pass
check=False
, which is already supported - Some tests are writing old data and expecting notifications to be created, we'll have to update these tests, in some cases we could use
freeze_time
to write past data if needed. - Let's update this doc page to mention this behavior:
/monitoring/user/device-checks-and-alert-settings.rst
, we can add a new section here and also reference the
send mode subsection in/openwrt-monitoring-agent/user/settings
to explain that we support writing old data which couldn't be collected due to network outages, but when we write this data we don't check threshold nor change the health status (only fresh data will do this).
Checklist
Reference to Existing Issue
Fixes #666