-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
API passes model.Earliest incorrectly #951
Comments
Thanks for reporting @bboreham. Help wanted if anyone is interested for a chance to contribute. |
I couldn't think of a clean and painless way to fix it. Maybe special-case the exact numbers/strings? Conceptually I'd like but it seems unlikely we can make that change without breaking people. |
I think we should first of all detect too high or too low timestamp, before conversion. It's easy thx to prometheus/prometheus#14986 experments and docs. Now we need another |
If you pass
model.Earliest.Time()
to prometheus/client_golang it sends -9223372036854776, which is 192 milliseconds less than the original. This value will cause an overflow when read byprometheus/web/api/v1
, turning it into a very large positive time.I am using github.com/prometheus/client_golang v1.11.0
and github.com/prometheus/client_model v0.2.0.
To illustrate:
https://go.dev/play/p/b_75bSN2Gyr
I believe the problem arises because
strconv.FormatFloat()
is asked to round the number as if it came from afloat64
, andmodel.Earliest
is the largest negativeint64
so it doesn't fit in afloat64
, and the milliseconds get dropped.This arose while trying to work round #621
The text was updated successfully, but these errors were encountered: