Skip to content

Commit

Permalink
Truncate min/max time to millisecond resolution
Browse files Browse the repository at this point in the history
Upstream prom's API "rounds" to millisecond precision so the min/max
we get from promql will only be at millisecond precision

Fixes #577
  • Loading branch information
jacksontj committed Mar 29, 2023
1 parent 96bd47b commit dd4613d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/promclient/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
// https://github.com/prometheus/client_golang/issues/951
var (
minTime = time.Unix(math.MinInt64/1000+62135596801, 0).UTC()
maxTime = time.Unix(math.MaxInt64/1000-62135596801, 999999999).UTC()
maxTime = time.Unix(math.MaxInt64/1000-62135596801, 999999999).UTC().Truncate(time.Millisecond) // Truncated to ms because prometheus' web API does this
)

// PromAPIV1 implements our internal API interface using *only* the v1 HTTP API
Expand Down

0 comments on commit dd4613d

Please sign in to comment.