prometheus/web/api/v1
Björn Rabenstein 4cb5f23c35
api: Improve doc comments for v1.MinTime and v1.MaxTime (#14986)
api: Improve doc comments for v1.MinTime and v1.MaxTime

While investigated something mostly unrelated, I got nerd-sniped by
the calculation of v1.MinTime and v1.MaxTime. The seemingly magic
number in there (62135596801) needed an explanation. While looking for
it, I found out that the offsets used here are actually needlessly
conservative. Since the timestamps are so far in the past or future,
respectively, that there is no practical impact, except that the
calculation is needlessly obfuscated. However, we won't change the
values now to not cause any confusion for users of this code. Still, I
think the doc comment should explain the circumstances so nobody gets
nerd-sniped again as I did today.

For the record: 62135596800 is the difference in seconds between 0001-01-01 00:00:00 (Unix time zero point) and 1971-01-01 00:00:00 (Go time zero point) in the Gregorian calendar. If "Prometheus time" were in seconds (not milliseconds), that difference would be relevant to prevent over-/underflow when converting from "Prometheus time" to "Go time".

Signed-off-by: beorn7 <beorn@grafana.com>

---------

Signed-off-by: beorn7 <beorn@grafana.com>
2024-10-01 18:03:46 +02:00
..
api_test.go chore: Fix typos (#14868) 2024-09-10 22:32:03 +02:00
api.go api: Improve doc comments for v1.MinTime and v1.MaxTime (#14986) 2024-10-01 18:03:46 +02:00
codec_test.go Implement fully-featured content negotiation for API requests, and allow overriding the default API codec. 2023-03-09 12:02:45 +11:00
codec.go Implement fully-featured content negotiation for API requests, and allow overriding the default API codec. 2023-03-09 12:02:45 +11:00
errors_test.go Add notifications to the web UI when configuration reload fails. 2024-09-27 15:28:38 +02:00
json_codec_test.go bugfix: add missing comma in vector/matrix array (#14047) 2024-05-03 14:07:49 -03:00
json_codec.go bugfix: add missing comma in vector/matrix array (#14047) 2024-05-03 14:07:49 -03:00
translate_ast.go Signed-off-by: Julius Volz <julius.volz@gmail.com> 2024-09-06 21:47:35 +02:00