Prometheus: Support 1ms resolution intervals (#44707)

* Prometheus: Support 1ms resolution in time ranges

* UI: Support 1ms resolution in time ranges
This commit is contained in:
Dan Keder
2022-06-29 07:39:50 +02:00
committed by GitHub
parent d32ec75661
commit 9595fd6b66
11 changed files with 188 additions and 16 deletions
@@ -630,7 +630,9 @@ func newDataFrame(name string, typ string, fields ...*data.Field) *data.Frame {
}
func alignTimeRange(t time.Time, step time.Duration, offset int64) time.Time {
return time.Unix(int64(math.Floor((float64(t.Unix()+offset)/step.Seconds()))*step.Seconds()-float64(offset)), 0)
offsetNano := float64(offset * 1e9)
stepNano := float64(step.Nanoseconds())
return time.Unix(0, int64(math.Floor((float64(t.UnixNano())+offsetNano)/stepNano)*stepNano-offsetNano))
}
func isVariableInterval(interval string) bool {