File: 04-api-headstats-int64-timestamps.patch

package info (click to toggle)
golang-github-prometheus-client-golang 1.14.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, bookworm-proposed-updates
  • size: 1,532 kB
  • sloc: makefile: 15
file content (32 lines) | stat: -rw-r--r-- 1,268 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Description: Use explicit int64 types for millisecond-resolution timestamps
 Untyped ints on 32-bit archs will lead to overflows when trying to store
 millisecond-resolution Unix timestamps. This patch specifies them as int64.
Author: Daniel Swarbrick <dswarbrick@debian.org>
Bug: https://github.com/prometheus/client_golang/issues/1132
Last-Update: 2022-09-16
--- a/api/prometheus/v1/api.go
+++ b/api/prometheus/v1/api.go
@@ -444,8 +444,8 @@ type TSDBHeadStats struct {
 	NumSeries     int `json:"numSeries"`
 	NumLabelPairs int `json:"numLabelPairs"`
 	ChunkCount    int `json:"chunkCount"`
-	MinTime       int `json:"minTime"`
-	MaxTime       int `json:"maxTime"`
+	MinTime       int64 `json:"minTime"`
+	MaxTime       int64 `json:"maxTime"`
 }
 
 // WalReplayStatus represents the wal replay status.
--- a/api/prometheus/v1/api_test.go
+++ b/api/prometheus/v1/api_test.go
@@ -1060,8 +1060,8 @@ func TestAPIs(t *testing.T) {
 					"numSeries":     18476,
 					"numLabelPairs": 4301,
 					"chunkCount":    72692,
-					"minTime":       1634644800304,
-					"maxTime":       1634650590304,
+					"minTime":       int64(1634644800304),
+					"maxTime":       int64(1634650590304),
 				},
 				"seriesCountByMetricName": []interface{}{
 					map[string]interface{}{