File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import (
19
19
"crypto/md5"
20
20
"encoding/json"
21
21
"fmt"
22
+ "math"
22
23
"net"
23
24
"net/http"
24
25
_ "net/http/pprof" // Comment this line to disable pprof endpoint.
@@ -266,8 +267,23 @@ func main() {
266
267
267
268
cfg .tsdb .RetentionDuration = chooseRetention (oldFlagRetentionDuration , newFlagRetentionDuration )
268
269
270
+ // Check for overflows. This limits our max retention to ~292.5y.
271
+ if cfg .tsdb .RetentionDuration < 0 {
272
+ cfg .tsdb .RetentionDuration = math .MaxInt64
273
+ }
274
+
269
275
if cfg .tsdb .MaxBlockDuration == 0 {
270
276
cfg .tsdb .MaxBlockDuration = cfg .tsdb .RetentionDuration / 10
277
+
278
+ // Prevent blocks from getting too big.
279
+ monthLong , err := model .ParseDuration ("31d" )
280
+ if err != nil {
281
+ panic (err )
282
+ }
283
+
284
+ if cfg .tsdb .MaxBlockDuration > monthLong {
285
+ cfg .tsdb .MaxBlockDuration = monthLong
286
+ }
271
287
}
272
288
273
289
promql .LookbackDelta = time .Duration (cfg .lookbackDelta )
You can’t perform that action at this time.
0 commit comments