grafana/0010-Prometheus-Fix-integer-overflow-in-rate-interval-cal.patch

21 lines
900 B
Diff
Raw Normal View History

2022-07-06 10:57:30 +00:00
From 22ea44e0867420bc7eb2ecf96e8d0b8e87dd7328 Mon Sep 17 00:00:00 2001
2022-06-22 17:13:29 +00:00
From: Andreas Gerstmayr <agerstmayr@redhat.com>
2022-07-06 10:57:30 +00:00
Date: Tue, 5 Jul 2022 17:04:13 +0200
2022-06-22 17:13:29 +00:00
Subject: [PATCH] Prometheus: Fix integer overflow in rate interval calculation
2022-07-06 10:57:30 +00:00
on 32-bit architectures 2
2022-06-22 17:13:29 +00:00
2022-07-06 10:57:30 +00:00
diff --git a/pkg/tsdb/prometheus/models/query.go b/pkg/tsdb/prometheus/models/query.go
index bdd48d08ed..aa2b1f9945 100644
--- a/pkg/tsdb/prometheus/models/query.go
+++ b/pkg/tsdb/prometheus/models/query.go
@@ -181,7 +181,7 @@ func calculateRateInterval(interval time.Duration, scrapeInterval string, interv
2022-06-22 17:13:29 +00:00
return time.Duration(0)
}
- rateInterval := time.Duration(int(math.Max(float64(interval+scrapeIntervalDuration), float64(4)*float64(scrapeIntervalDuration))))
+ rateInterval := time.Duration(int64(math.Max(float64(interval+scrapeIntervalDuration), float64(4)*float64(scrapeIntervalDuration))))
return rateInterval
}