From 6cd53c4d8381fff779c4db66ff74d69d8d2b2eab Mon Sep 17 00:00:00 2001 From: prombot Date: Thu, 16 Sep 2021 00:01:42 +0000 Subject: [PATCH 01/10] Update common Prometheus files Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 29 +++++++++++++++++++++++++++++ Makefile.common | 10 ++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/golangci-lint.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..431fef7 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,29 @@ +name: golangci-lint +on: + push: + paths: + - "go.sum" + - "go.mod" + - "**.go" + - "scripts/errcheck_excludes.txt" + - ".github/workflows/golangci-lint.yml" + pull_request: + paths: + - "go.sum" + - "go.mod" + - "**.go" + - "scripts/errcheck_excludes.txt" + - ".github/workflows/golangci-lint.yml" + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.42.0 diff --git a/Makefile.common b/Makefile.common index a1b1ca4..99e8f9f 100644 --- a/Makefile.common +++ b/Makefile.common @@ -83,12 +83,18 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.39.0 +GOLANGCI_LINT_VERSION ?= v1.42.0 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386)) - GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint + # If we're in CI and there is an Actions file, that means the linter + # is being run in Actions, so we don't need to run it here. + ifeq (,$(CIRCLE_JOB)) + GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint + else ifeq (,$(wildcard .github/workflows/golangci-lint.yml)) + GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint + endif endif endif From 679eb0d315d3bad8963927751537034476a52e25 Mon Sep 17 00:00:00 2001 From: David Trudgian Date: Wed, 29 Sep 2021 05:11:17 -0500 Subject: [PATCH 02/10] Update cespare/xxhash dependency (#913) Brings in a fix for asm errors when dynamic linking with Go 1.17. Fixes #912 Signed-off-by: David Trudgian --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 02af414..c2b9327 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/prometheus/client_golang require ( github.com/beorn7/perks v1.0.1 - github.com/cespare/xxhash/v2 v2.1.1 + github.com/cespare/xxhash/v2 v2.1.2 github.com/golang/protobuf v1.4.3 github.com/json-iterator/go v1.1.11 github.com/prometheus/client_model v0.2.0 diff --git a/go.sum b/go.sum index 6640a38..6d10b69 100644 --- a/go.sum +++ b/go.sum @@ -43,8 +43,9 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= From a7919ad927435a1d1d59c0beae98ee9dcfca016f Mon Sep 17 00:00:00 2001 From: prombot Date: Sat, 23 Oct 2021 00:01:35 +0000 Subject: [PATCH 03/10] Update common Prometheus files Signed-off-by: prombot --- Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.common b/Makefile.common index 99e8f9f..ed7d182 100644 --- a/Makefile.common +++ b/Makefile.common @@ -160,7 +160,7 @@ endif update-go-deps: @echo ">> updating Go dependencies" @for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \ - $(GO) get $$m; \ + $(GO) get -d $$m; \ done GO111MODULE=$(GO111MODULE) $(GO) mod tidy ifneq (,$(wildcard vendor)) From f78dc19a65a9a4626d03dcdffe1366280629c4fc Mon Sep 17 00:00:00 2001 From: beorn7 Date: Wed, 10 Nov 2021 16:20:10 +0100 Subject: [PATCH 04/10] Move flags and metrics into main() Fixes #933. Signed-off-by: beorn7 --- examples/random/main.go | 66 ++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/examples/random/main.go b/examples/random/main.go index 20a9db5..cf44863 100644 --- a/examples/random/main.go +++ b/examples/random/main.go @@ -29,47 +29,45 @@ import ( "github.com/prometheus/client_golang/prometheus/promhttp" ) -var ( - addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.") - uniformDomain = flag.Float64("uniform.domain", 0.0002, "The domain for the uniform distribution.") - normDomain = flag.Float64("normal.domain", 0.0002, "The domain for the normal distribution.") - normMean = flag.Float64("normal.mean", 0.00001, "The mean for the normal distribution.") - oscillationPeriod = flag.Duration("oscillation-period", 10*time.Minute, "The duration of the rate oscillation period.") -) - -var ( - // Create a summary to track fictional interservice RPC latencies for three - // distinct services with different latency distributions. These services are - // differentiated via a "service" label. - rpcDurations = prometheus.NewSummaryVec( - prometheus.SummaryOpts{ - Name: "rpc_durations_seconds", - Help: "RPC latency distributions.", - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }, - []string{"service"}, +func main() { + var ( + addr = flag.String("listen-address", ":8080", "The address to listen on for HTTP requests.") + uniformDomain = flag.Float64("uniform.domain", 0.0002, "The domain for the uniform distribution.") + normDomain = flag.Float64("normal.domain", 0.0002, "The domain for the normal distribution.") + normMean = flag.Float64("normal.mean", 0.00001, "The mean for the normal distribution.") + oscillationPeriod = flag.Duration("oscillation-period", 10*time.Minute, "The duration of the rate oscillation period.") + ) + + flag.Parse() + + var ( + // Create a summary to track fictional interservice RPC latencies for three + // distinct services with different latency distributions. These services are + // differentiated via a "service" label. + rpcDurations = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Name: "rpc_durations_seconds", + Help: "RPC latency distributions.", + Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, + }, + []string{"service"}, + ) + // The same as above, but now as a histogram, and only for the normal + // distribution. The buckets are targeted to the parameters of the + // normal distribution, with 20 buckets centered on the mean, each + // half-sigma wide. + rpcDurationsHistogram = prometheus.NewHistogram(prometheus.HistogramOpts{ + Name: "rpc_durations_histogram_seconds", + Help: "RPC latency distributions.", + Buckets: prometheus.LinearBuckets(*normMean-5**normDomain, .5**normDomain, 20), + }) ) - // The same as above, but now as a histogram, and only for the normal - // distribution. The buckets are targeted to the parameters of the - // normal distribution, with 20 buckets centered on the mean, each - // half-sigma wide. - rpcDurationsHistogram = prometheus.NewHistogram(prometheus.HistogramOpts{ - Name: "rpc_durations_histogram_seconds", - Help: "RPC latency distributions.", - Buckets: prometheus.LinearBuckets(*normMean-5**normDomain, .5**normDomain, 20), - }) -) -func init() { // Register the summary and the histogram with Prometheus's default registry. prometheus.MustRegister(rpcDurations) prometheus.MustRegister(rpcDurationsHistogram) // Add Go module build info. prometheus.MustRegister(prometheus.NewBuildInfoCollector()) -} - -func main() { - flag.Parse() start := time.Now() From 55320aa8b0fb73c39b0a78380defc3f0574d1fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6khan=20=C3=96zelo=C4=9Flu?= Date: Thu, 25 Nov 2021 11:21:10 +0300 Subject: [PATCH 05/10] Fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gökhan Özeloğlu --- prometheus/push/push_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prometheus/push/push_test.go b/prometheus/push/push_test.go index 99155b0..e55e966 100644 --- a/prometheus/push/push_test.go +++ b/prometheus/push/push_test.go @@ -199,7 +199,7 @@ func TestPush(t *testing.T) { Collector(metric1). Collector(metric2). Push(); err == nil { - t.Error("push with empty job succeded") + t.Error("push with empty job succeeded") } else { if got, want := err, errJobEmpty; got != want { t.Errorf("got error %q, want %q", got, want) From 440c09d3ec84c3072ec3146fdf2734b7a11db593 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Sat, 4 Dec 2021 22:19:58 -0800 Subject: [PATCH 06/10] support wal replay status api Signed-off-by: Ben Ye --- api/prometheus/v1/api.go | 27 +++++++++++++++++++++++++++ api/prometheus/v1/api_test.go | 31 +++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/api/prometheus/v1/api.go b/api/prometheus/v1/api.go index 0c8de07..f6812d0 100644 --- a/api/prometheus/v1/api.go +++ b/api/prometheus/v1/api.go @@ -139,6 +139,7 @@ const ( epBuildinfo = apiPrefix + "/status/buildinfo" epRuntimeinfo = apiPrefix + "/status/runtimeinfo" epTSDB = apiPrefix + "/status/tsdb" + epWalReplay = apiPrefix + "/status/walreplay" ) // AlertState models the state of an alert. @@ -261,6 +262,8 @@ type API interface { Metadata(ctx context.Context, metric string, limit string) (map[string][]Metadata, error) // TSDB returns the cardinality statistics. TSDB(ctx context.Context) (TSDBResult, error) + // WalReplay returns the current replay status of the wal. + WalReplay(ctx context.Context) (WalReplayStatus, error) } // AlertsResult contains the result from querying the alerts endpoint. @@ -437,6 +440,13 @@ type TSDBResult struct { SeriesCountByLabelValuePair []Stat `json:"seriesCountByLabelValuePair"` } +// WalReplayStatus represents the wal replay status. +type WalReplayStatus struct { + Min int `json:"min"` + Max int `json:"max"` + Current int `json:"current"` +} + // Stat models information about statistic value. type Stat struct { Name string `json:"name"` @@ -984,6 +994,23 @@ func (h *httpAPI) TSDB(ctx context.Context) (TSDBResult, error) { return res, json.Unmarshal(body, &res) } +func (h *httpAPI) WalReplay(ctx context.Context) (WalReplayStatus, error) { + u := h.client.URL(epWalReplay, nil) + + req, err := http.NewRequest(http.MethodGet, u.String(), nil) + if err != nil { + return WalReplayStatus{}, err + } + + _, body, _, err := h.client.Do(ctx, req) + if err != nil { + return WalReplayStatus{}, err + } + + var res WalReplayStatus + return res, json.Unmarshal(body, &res) +} + func (h *httpAPI) QueryExemplars(ctx context.Context, query string, startTime time.Time, endTime time.Time) ([]ExemplarQueryResult, error) { u := h.client.URL(epQueryExemplars, nil) q := u.Query() diff --git a/api/prometheus/v1/api_test.go b/api/prometheus/v1/api_test.go index 4197d42..a9b7f20 100644 --- a/api/prometheus/v1/api_test.go +++ b/api/prometheus/v1/api_test.go @@ -230,6 +230,13 @@ func TestAPIs(t *testing.T) { } } + doWalReply := func() func() (interface{}, Warnings, error) { + return func() (interface{}, Warnings, error) { + v, err := promAPI.WalReplay(context.Background()) + return v, nil, err + } + } + doQueryExemplars := func(query string, startTime time.Time, endTime time.Time) func() (interface{}, Warnings, error) { return func() (interface{}, Warnings, error) { v, err := promAPI.QueryExemplars(context.Background(), query, startTime, endTime) @@ -1198,6 +1205,30 @@ func TestAPIs(t *testing.T) { }, }, + { + do: doWalReply(), + reqMethod: "GET", + reqPath: "/api/v1/status/walreplay", + inErr: fmt.Errorf("some error"), + err: fmt.Errorf("some error"), + }, + + { + do: doWalReply(), + reqMethod: "GET", + reqPath: "/api/v1/status/walreplay", + inRes: map[string]interface{}{ + "min": 2, + "max": 5, + "current": 40, + }, + res: WalReplayStatus{ + Min: 2, + Max: 5, + Current: 40, + }, + }, + { do: doQueryExemplars("tns_request_duration_seconds_bucket", testTime.Add(-1*time.Minute), testTime), reqMethod: "GET", From d28a147d3c00e31af24b69aaed97cac906991673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Sat, 18 Sep 2021 10:57:17 +0200 Subject: [PATCH 07/10] chore: adds support for go 1.17 on CI. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Carlos Chávez --- .circleci/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a62505e..b3f9c51 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,6 +63,8 @@ workflows: name: go-1-16 go_version: "1.16" run_lint: true - # Style and unused/missing packages are only checked against - # the latest supported Go version. + - test: + name: go-1-17 + go_version: "1.17" + run_lint: true run_style_and_unused: true From 8535b620213443badedb837314aa0a6d1ee0a22c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Fri, 17 Dec 2021 23:07:49 +0100 Subject: [PATCH 08/10] Add new go:build lines for go 1.17 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Rüger --- prometheus/collectors/dbstats_collector_go115.go | 1 + prometheus/collectors/dbstats_collector_pre_go115.go | 1 + prometheus/process_collector_other.go | 1 + prometheus/process_collector_test.go | 1 + 4 files changed, 4 insertions(+) diff --git a/prometheus/collectors/dbstats_collector_go115.go b/prometheus/collectors/dbstats_collector_go115.go index a6e6268..6d152fb 100644 --- a/prometheus/collectors/dbstats_collector_go115.go +++ b/prometheus/collectors/dbstats_collector_go115.go @@ -11,6 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.15 // +build go1.15 package collectors diff --git a/prometheus/collectors/dbstats_collector_pre_go115.go b/prometheus/collectors/dbstats_collector_pre_go115.go index 0568aff..6523506 100644 --- a/prometheus/collectors/dbstats_collector_pre_go115.go +++ b/prometheus/collectors/dbstats_collector_pre_go115.go @@ -11,6 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !go1.15 // +build !go1.15 package collectors diff --git a/prometheus/process_collector_other.go b/prometheus/process_collector_other.go index 3117461..2dc3660 100644 --- a/prometheus/process_collector_other.go +++ b/prometheus/process_collector_other.go @@ -11,6 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !windows // +build !windows package prometheus diff --git a/prometheus/process_collector_test.go b/prometheus/process_collector_test.go index 7b19c5e..3a604ab 100644 --- a/prometheus/process_collector_test.go +++ b/prometheus/process_collector_test.go @@ -11,6 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build linux // +build linux package prometheus From 70a41d58f8f68d12db5547096d9ecb0fcb663764 Mon Sep 17 00:00:00 2001 From: prombot Date: Mon, 20 Dec 2021 20:51:20 +0000 Subject: [PATCH 09/10] Update common Prometheus files Signed-off-by: prombot --- .circleci/config.yml | 2 +- .github/workflows/golangci-lint.yml | 2 ++ Makefile.common | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b3f9c51..95f2391 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 orbs: go: circleci/go@0.2.0 - prometheus: prometheus/prometheus@0.11.0 + prometheus: prometheus/prometheus@0.15.0 jobs: test: parameters: diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 431fef7..f96c76a 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -7,6 +7,7 @@ on: - "**.go" - "scripts/errcheck_excludes.txt" - ".github/workflows/golangci-lint.yml" + - ".golangci.yml" pull_request: paths: - "go.sum" @@ -14,6 +15,7 @@ on: - "**.go" - "scripts/errcheck_excludes.txt" - ".github/workflows/golangci-lint.yml" + - ".golangci.yml" jobs: golangci: diff --git a/Makefile.common b/Makefile.common index ed7d182..bf7304e 100644 --- a/Makefile.common +++ b/Makefile.common @@ -78,7 +78,7 @@ ifneq ($(shell which gotestsum),) endif endif -PROMU_VERSION ?= 0.12.0 +PROMU_VERSION ?= 0.13.0 PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz GOLANGCI_LINT := From dc1559e8efad6493bfa27e5af5e9a030e8675d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Wed, 5 Jan 2022 09:09:29 +0000 Subject: [PATCH 10/10] Update /api/v1/status/tsdb to include headStats (#925) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current structs for v1 HTTP API assume that there is chunkCount and timeSeriesCount on /api/v1/status/runtimeinfo, which seems to be gone for at least a few releases. /api/v1/status/tsdb now holds an extra headStats block with chunkCount, numSeries and a few other fields. Update API models and tests to reflect this change. Signed-off-by: Łukasz Mierzwa --- api/prometheus/v1/api.go | 20 ++++++++++++++------ api/prometheus/v1/api_test.go | 18 ++++++++++++++---- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/api/prometheus/v1/api.go b/api/prometheus/v1/api.go index f6812d0..857512f 100644 --- a/api/prometheus/v1/api.go +++ b/api/prometheus/v1/api.go @@ -306,8 +306,6 @@ type RuntimeinfoResult struct { CWD string `json:"CWD"` ReloadConfigSuccess bool `json:"reloadConfigSuccess"` LastConfigTime time.Time `json:"lastConfigTime"` - ChunkCount int `json:"chunkCount"` - TimeSeriesCount int `json:"timeSeriesCount"` CorruptionCount int `json:"corruptionCount"` GoroutineCount int `json:"goroutineCount"` GOMAXPROCS int `json:"GOMAXPROCS"` @@ -434,10 +432,20 @@ type queryResult struct { // TSDBResult contains the result from querying the tsdb endpoint. type TSDBResult struct { - SeriesCountByMetricName []Stat `json:"seriesCountByMetricName"` - LabelValueCountByLabelName []Stat `json:"labelValueCountByLabelName"` - MemoryInBytesByLabelName []Stat `json:"memoryInBytesByLabelName"` - SeriesCountByLabelValuePair []Stat `json:"seriesCountByLabelValuePair"` + HeadStats TSDBHeadStats `json:"headStats"` + SeriesCountByMetricName []Stat `json:"seriesCountByMetricName"` + LabelValueCountByLabelName []Stat `json:"labelValueCountByLabelName"` + MemoryInBytesByLabelName []Stat `json:"memoryInBytesByLabelName"` + SeriesCountByLabelValuePair []Stat `json:"seriesCountByLabelValuePair"` +} + +// TSDBHeadStats contains TSDB stats +type TSDBHeadStats struct { + NumSeries int `json:"numSeries"` + NumLabelPairs int `json:"numLabelPairs"` + ChunkCount int `json:"chunkCount"` + MinTime int `json:"minTime"` + MaxTime int `json:"maxTime"` } // WalReplayStatus represents the wal replay status. diff --git a/api/prometheus/v1/api_test.go b/api/prometheus/v1/api_test.go index a9b7f20..e7d0b4c 100644 --- a/api/prometheus/v1/api_test.go +++ b/api/prometheus/v1/api_test.go @@ -703,8 +703,6 @@ func TestAPIs(t *testing.T) { "CWD": "/prometheus", "reloadConfigSuccess": true, "lastConfigTime": "2020-05-18T15:52:56Z", - "chunkCount": 72692, - "timeSeriesCount": 18476, "corruptionCount": 0, "goroutineCount": 217, "GOMAXPROCS": 2, @@ -717,8 +715,6 @@ func TestAPIs(t *testing.T) { CWD: "/prometheus", ReloadConfigSuccess: true, LastConfigTime: time.Date(2020, 5, 18, 15, 52, 56, 0, time.UTC), - ChunkCount: 72692, - TimeSeriesCount: 18476, CorruptionCount: 0, GoroutineCount: 217, GOMAXPROCS: 2, @@ -1152,6 +1148,13 @@ func TestAPIs(t *testing.T) { reqMethod: "GET", reqPath: "/api/v1/status/tsdb", inRes: map[string]interface{}{ + "headStats": map[string]interface{}{ + "numSeries": 18476, + "numLabelPairs": 4301, + "chunkCount": 72692, + "minTime": 1634644800304, + "maxTime": 1634650590304, + }, "seriesCountByMetricName": []interface{}{ map[string]interface{}{ "name": "kubelet_http_requests_duration_seconds_bucket", @@ -1178,6 +1181,13 @@ func TestAPIs(t *testing.T) { }, }, res: TSDBResult{ + HeadStats: TSDBHeadStats{ + NumSeries: 18476, + NumLabelPairs: 4301, + ChunkCount: 72692, + MinTime: 1634644800304, + MaxTime: 1634650590304, + }, SeriesCountByMetricName: []Stat{ { Name: "kubelet_http_requests_duration_seconds_bucket",