Open Gim6626 opened 3 years ago
I ran into this same error message when using Prometheus. This is an issue with promethus itself, not an error in client_python.
It turns out, it's not comparing the time of the incoming log to the current system time. It is comparing it to the latest time in the database. The log message is missing three key pieces of data: what the time of the entry is, whether the entry is too old or too far in the future, and boundry date/time that determines whether an entry is acceptable.
As best I can tell, the responsible code is here. I say this because the similar code in target.go did not change the error message when I commented it out and deployed my modified build, whereas when I commented out the checks in head_append.go, they got rejected because they were out of order instead of too old or too far in the future.
Thus, if you have an entry in the database in the future, all new data will be rejected because it's too old. It doesn't look like promtool tsdb ...
has any way to delete future entries. I solved it on my system by stopping prometheus, removing the data directory and starting prometheus again.
This can be reproduced by setting the system clock to the future, adding some data to prometheus, and then correcting the system clock.
Apologies if replying to an old post is a faux pas here, but there's only one other place this issue seems to have been discussed and that thread was closed without resolving the issue. So my hope is that this comment will help people in the future when they run into this same error message.
Hi!
Faced strange situation with timestamps.
Briefly:
datetime.datetime.now()
- everything is ok.Here is code example with comments about which metrics works and which don't:
Message from Prometheus log about trouble metric:
But date is correct, here is Python code for used date and format:
I've spent more than one day trying to google, read docs and resolve it - no results.
Any help will be very appreciated.