From 5b73e518260d8bab36ebb1c0d0a5826eba8fc0a0 Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Fri, 8 Apr 2022 14:19:26 +0200 Subject: [PATCH 01/11] cut v2.35.0-rc0 (#10543) Signed-off-by: Augustin Husson --- CHANGELOG.md | 16 ++++++++++++++++ VERSION | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d24177d4f..3880619f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +## 2.35.0-rc0 / 2022-04-08 + +* [CHANGE] TSDB: Delete *.tmp WAL files when Prometheus starts. #10317 +* [CHANGE] promtool: Add new flag `--lint` (enabled by default) for the commands `check rules` and `check config`, resulting in a new exit code (`3`) for linter errors. #10435 +* [FEATURE] Support for automatically setting the variable `GOMAXPROCS` to the container CPU limit. Enable with the flag `--enable-feature=auto-gomaxprocs` #10498 +* [FEATURE] PromQL: Extend statistics with total and peak number of samples in a query. Additionally, per-step statistics are available with --enable-feature=promql-per-step-stats and using `stats=all` in the query API. +Enable with the flag `--enable-feature=per-step-stats` #10369 +* [ENHANCEMENT] Prometheus is built with Go 1.18. #10501 +* [ENHANCEMENT] TSDB: more efficient sorting of postings read from WAL at startup. #10500 +* [ENHANCEMENT] Azure SD: Add metric to track Azure SD failures #10476 +* [ENHANCEMENT] Azure SD: Add an optional `resource_group` configuration. #10365 +* [ENHANCEMENT] Kubernetes SD: Support `discovery.k8s.io/v1` `EndpointSlice` (previously only `discovery.k8s.io/v1beta1` `EndpointSlice` was supported). #9570 +* [BUGFIX] Kubernetes SD: Explicitly include gcp auth from k8s.io. #10516 +* [BUGFIX] Fix OpenMetrics parser to sort uppercase labels correctly. #10510 +* [BUGFIX] UI: Fix scrape interval and duration tooltip not showing on target page. #10545 + ## 2.34.0 / 2022-03-15 * [CHANGE] UI: Classic UI removed. #10208 diff --git a/VERSION b/VERSION index dc1591835..044037b8c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.34.0 +2.35.0-rc0 From 8abef6d661b8dc82a25e071fcfbbec1c0298c949 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Tue, 12 Apr 2022 11:00:54 +0200 Subject: [PATCH 02/11] Proper support for go modules. (#10486) * Proper support for go modules. This pull requests makes Prometheus go-mod compatible. The general idea is to release the Prometheus libraries as v0.x releases, next to the v2.x tags used by end users. This is done by mirroring Prometheus 2.x tags with Prometheus 0.x tags. When v2.X.0 is released, we would release v0.X.0. Pre-go mod versions are retracted from go.mod. This is not nice but should work. Only v2.x tags will be built and released by CI. v0.x.x tags would just be normal tags in the repo, not promoted as releases. Signed-off-by: Julien Pivotto --- .circleci/config.yml | 6 +-- .github/workflows/codeql-analysis.yml | 45 ++++-------------- RELEASE.md | 12 +++++ go.mod | 66 +++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 39 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 44cf04abd..c7f59df31 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -148,7 +148,7 @@ workflows: promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386" filters: tags: - ignore: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ + ignore: /^v2(\.[0-9]+){2}(-.+|[^-.]*)$/ branches: ignore: /^(main|release-.*|.*build-all.*)$/ - prometheus/build: @@ -158,7 +158,7 @@ workflows: branches: only: /^(main|release-.*|.*build-all.*)$/ tags: - only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ + only: /^v2(\.[0-9]+){2}(-.+|[^-.]*)$/ - prometheus/publish_main: context: org-context requires: @@ -177,7 +177,7 @@ workflows: - build_all filters: tags: - only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ + only: /^v2(\.[0-9]+){2}(-.+|[^-.]*)$/ branches: ignore: /.*/ image: circleci/golang:1-node diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 903e221c7..55890343d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,21 +1,10 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# +--- name: "CodeQL" on: push: branches: [main, release-*] pull_request: - # The branches below must be a subset of the branches above branches: [main] schedule: - cron: "26 14 * * 1" @@ -24,44 +13,28 @@ jobs: analyze: name: Analyze runs-on: ubuntu-latest + permissions: + security-events: write strategy: fail-fast: false matrix: language: ["go", "javascript"] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - name: Checkout repository uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: '>=1.17 <1.18' - # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release + uses: github/codeql-action/autobuild@v2 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/RELEASE.md b/RELEASE.md index 3108cf4e1..65da3c0c3 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -147,6 +147,18 @@ $ git tag -s "${tag}" -m "${tag}" $ git push origin "${tag}" ``` +Go modules versioning requires strict use of semver. Because we do not commit to +avoid code-level breaking changes for the libraries between minor releases of +the Prometheus server, we use major version zero releases for the libraries. + +Tag the new library release via the following commands: + +```bash +$ tag="v$(sed s/2/0/ < VERSION)" +$ git tag -s "${tag}" -m "${tag}" +$ git push origin "${tag}" +``` + Optionally, you can use this handy `.gitconfig` alias. ```ini diff --git a/go.mod b/go.mod index 96b4449ba..36cd6b3ca 100644 --- a/go.mod +++ b/go.mod @@ -124,3 +124,69 @@ exclude ( k8s.io/client-go v9.0.0+incompatible k8s.io/client-go v9.0.0-invalid+incompatible ) + +retract ( + v2.5.0+incompatible + v2.5.0-rc.2+incompatible + v2.5.0-rc.1+incompatible + v2.5.0-rc.0+incompatible + v2.4.3+incompatible + v2.4.2+incompatible + v2.4.1+incompatible + v2.4.0+incompatible + v2.4.0-rc.0+incompatible + v2.3.2+incompatible + v2.3.1+incompatible + v2.3.0+incompatible + v2.2.1+incompatible + v2.2.0+incompatible + v2.2.0-rc.1+incompatible + v2.2.0-rc.0+incompatible + v2.1.0+incompatible + v2.0.0+incompatible + v2.0.0-rc.3+incompatible + v2.0.0-rc.2+incompatible + v2.0.0-rc.1+incompatible + v2.0.0-rc.0+incompatible + v2.0.0-beta.5+incompatible + v2.0.0-beta.4+incompatible + v2.0.0-beta.3+incompatible + v2.0.0-beta.2+incompatible + v2.0.0-beta.1+incompatible + v2.0.0-beta.0+incompatible + v2.0.0-alpha.3+incompatible + v2.0.0-alpha.2+incompatible + v2.0.0-alpha.1+incompatible + v2.0.0-alpha.0+incompatible + v1.8.2 + v1.8.1 + v1.8.0 + v1.7.2 + v1.7.1 + v1.7.0 + v1.6.3 + v1.6.2 + v1.6.1 + v1.6.0 + v1.5.3 + v1.5.2 + v1.5.1 + v1.5.0 + v1.4.1 + v1.4.0 + v1.3.1 + v1.3.0 + v1.3.0-beta.0 + v1.2.3 + v1.2.2 + v1.2.1 + v1.2.0 + v1.1.3 + v1.1.2 + v1.1.1 + v1.1.0 + v1.0.2 + v1.0.1 + v1.0.0 + v1.0.0-rc.0 +) From 1186974715c58edc3317221bdd7bf6d510bceb59 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Tue, 12 Apr 2022 19:23:02 +0200 Subject: [PATCH 03/11] Publish UI release artefact in our github releases (#10577) This will make UI static files part of the release artefacts, for consumption by downstream distributions. Signed-off-by: Julien Pivotto --- .circleci/config.yml | 6 ++++-- scripts/package_assets.sh | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c7f59df31..966c546f2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,8 +63,10 @@ jobs: - run: make ui-build-module - run: make ui-test - run: make assets-tarball -o assets - - store_artifacts: - path: web/ui/static.tar.gz + - persist_to_workspace: + root: . + paths: + - .tarballs - save_cache: key: v3-npm-deps-{{ checksum "web/ui/package-lock.json" }} paths: diff --git a/scripts/package_assets.sh b/scripts/package_assets.sh index a1f1571dd..038993851 100755 --- a/scripts/package_assets.sh +++ b/scripts/package_assets.sh @@ -4,5 +4,7 @@ set -euo pipefail +version="$(< VERSION)" +mkdir -p .tarballs cd web/ui -find static -type f -not -name '*.gz' -print0 | xargs -0 tar czf static.tar.gz +find static -type f -not -name '*.gz' -print0 | xargs -0 tar czf ../../.tarballs/prometheus-web-ui-${version}.tar.gz From dc8b67329918329c02c538b785ff963a5e332f17 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Tue, 12 Apr 2022 20:22:51 +0200 Subject: [PATCH 04/11] Build the UI when making UI tarball (#10578) We run ui-install on ci but not ui-build. This PR resolves that. Signed-off-by: Julien Pivotto --- .circleci/config.yml | 4 +--- Makefile | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 966c546f2..5bbeecedf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -58,11 +58,9 @@ jobs: keys: - v3-npm-deps-{{ checksum "web/ui/package-lock.json" }} - v3-npm-deps- - - run: make ui-install + - run: make assets-tarball - run: make ui-lint - - run: make ui-build-module - run: make ui-test - - run: make assets-tarball -o assets - persist_to_workspace: root: . paths: diff --git a/Makefile b/Makefile index c5b58bf5a..59c16e1d6 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ assets-compress: assets scripts/compress_assets.sh .PHONY: assets-tarball -assets-tarball: assets-compress +assets-tarball: assets @echo '>> packaging assets' scripts/package_assets.sh From a5e75f355113374cc3834c4db1dbd2692fd55ebf Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Wed, 13 Apr 2022 12:29:48 +0200 Subject: [PATCH 05/11] changelog: Add missing enhancements (#10583) Signed-off-by: Julien Pivotto --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3880619f7..6e305ea26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 2.35.0-rc0 / 2022-04-08 -* [CHANGE] TSDB: Delete *.tmp WAL files when Prometheus starts. #10317 +* [CHANGE] TSDB: Delete `*.tmp` WAL files when Prometheus starts. #10317 * [CHANGE] promtool: Add new flag `--lint` (enabled by default) for the commands `check rules` and `check config`, resulting in a new exit code (`3`) for linter errors. #10435 * [FEATURE] Support for automatically setting the variable `GOMAXPROCS` to the container CPU limit. Enable with the flag `--enable-feature=auto-gomaxprocs` #10498 * [FEATURE] PromQL: Extend statistics with total and peak number of samples in a query. Additionally, per-step statistics are available with --enable-feature=promql-per-step-stats and using `stats=all` in the query API. @@ -10,6 +10,8 @@ Enable with the flag `--enable-feature=per-step-stats` #10369 * [ENHANCEMENT] Azure SD: Add metric to track Azure SD failures #10476 * [ENHANCEMENT] Azure SD: Add an optional `resource_group` configuration. #10365 * [ENHANCEMENT] Kubernetes SD: Support `discovery.k8s.io/v1` `EndpointSlice` (previously only `discovery.k8s.io/v1beta1` `EndpointSlice` was supported). #9570 +* [ENHANCEMENT] OAuth2: Support for using a proxy URL to fetch OAuth2 tokens. #10492 +* [ENHANCEMENT] Configuration: Add the ability to disable HTTP2. #10492 * [BUGFIX] Kubernetes SD: Explicitly include gcp auth from k8s.io. #10516 * [BUGFIX] Fix OpenMetrics parser to sort uppercase labels correctly. #10510 * [BUGFIX] UI: Fix scrape interval and duration tooltip not showing on target page. #10545 From a1aa3721e8893a67c1fde9ea1e5a3778be77dcc7 Mon Sep 17 00:00:00 2001 From: TomasKohout Date: Wed, 13 Apr 2022 15:41:28 +0200 Subject: [PATCH 06/11] uber.go/automaxprocs package upgrade for cgroups2 support (#10584) Signed-off-by: Tomas Kohout --- go.mod | 2 +- go.sum | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 36cd6b3ca..9fecc16ad 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,7 @@ require ( go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/otel/trace v1.6.1 go.uber.org/atomic v1.9.0 - go.uber.org/automaxprocs v1.4.0 + go.uber.org/automaxprocs v1.5.1 go.uber.org/goleak v1.1.12 golang.org/x/net v0.0.0-20220325170049-de3da57026de golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a diff --git a/go.sum b/go.sum index f97a568df..2e3f5a14e 100644 --- a/go.sum +++ b/go.sum @@ -1026,6 +1026,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= +github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= +github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/alertmanager v0.24.0 h1:HBWR3lk4uy3ys+naDZthDdV7yEsxpaNeZuUS+hJgrOw= github.com/prometheus/alertmanager v0.24.0/go.mod h1:r6fy/D7FRuZh5YbnX6J3MBY0eI4Pb5yPYS7/bPSXXqI= github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -1294,8 +1296,8 @@ go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/automaxprocs v1.4.0 h1:CpDZl6aOlLhReez+8S3eEotD7Jx0Os++lemPlMULQP0= -go.uber.org/automaxprocs v1.4.0/go.mod h1:/mTEdr7LvHhs0v7mjdxDreTz1OG5zdZGqgOnhWiR/+Q= +go.uber.org/automaxprocs v1.5.1 h1:e1YG66Lrk73dn4qhg8WFSvhF0JuFQF0ERIp4rpuV8Qk= +go.uber.org/automaxprocs v1.5.1/go.mod h1:BF4eumQw0P9GtnuxxovUd06vwm1o18oMzFtK66vU6XU= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= From 286dfc70b7c7d22a17068b5038bc13f02bf87d70 Mon Sep 17 00:00:00 2001 From: Robert Fratto Date: Thu, 14 Apr 2022 04:27:06 -0400 Subject: [PATCH 07/11] tsdb/agent: port grafana/agent#676 (#10587) * tsdb/agent: port grafana/agent#676 grafana/agent#676 fixed an issue where a loading a WAL with multiple segments may result in ref ID collision. The starting ref ID for new series should be set to the highest ref ID across all series records from all WAL segments. This fixes an issue where the starting ref ID was incorrectly set to the highest ref ID found in the newest segment, which may not have any ref IDs at all if no series records have been appended to it yet. Signed-off-by: Robert Fratto * tsdb/agent: update terminology (s/ref ID/nextRef) Signed-off-by: Robert Fratto --- tsdb/agent/db.go | 2 +- tsdb/agent/db_test.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/tsdb/agent/db.go b/tsdb/agent/db.go index 7d42d14fe..a06d8f1f9 100644 --- a/tsdb/agent/db.go +++ b/tsdb/agent/db.go @@ -392,7 +392,7 @@ func (db *DB) replayWAL() error { func (db *DB) loadWAL(r *wal.Reader, multiRef map[chunks.HeadSeriesRef]chunks.HeadSeriesRef) (err error) { var ( dec record.Decoder - lastRef chunks.HeadSeriesRef + lastRef = chunks.HeadSeriesRef(db.nextRef.Load()) decoded = make(chan interface{}, 10) errCh = make(chan error, 1) diff --git a/tsdb/agent/db_test.go b/tsdb/agent/db_test.go index e99712f71..a44b6c728 100644 --- a/tsdb/agent/db_test.go +++ b/tsdb/agent/db_test.go @@ -15,6 +15,7 @@ package agent import ( "context" + "fmt" "path/filepath" "strconv" "testing" @@ -24,6 +25,7 @@ import ( "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/model" "github.com/stretchr/testify/require" "github.com/prometheus/prometheus/model/exemplar" @@ -409,6 +411,41 @@ func TestLockfile(t *testing.T) { }) } +func Test_ExistingWAL_NextRef(t *testing.T) { + dbDir := t.TempDir() + rs := remote.NewStorage(log.NewNopLogger(), nil, startTime, dbDir, time.Second*30, nil) + defer func() { + require.NoError(t, rs.Close()) + }() + + db, err := Open(log.NewNopLogger(), nil, rs, dbDir, DefaultOptions()) + require.NoError(t, err) + + seriesCount := 10 + + // Append series + app := db.Appender(context.Background()) + for i := 0; i < seriesCount; i++ { + lset := labels.Labels{ + {Name: model.MetricNameLabel, Value: fmt.Sprintf("series_%d", i)}, + } + _, err := app.Append(0, lset, 0, 100) + require.NoError(t, err) + } + require.NoError(t, app.Commit()) + + // Truncate the WAL to force creation of a new segment. + require.NoError(t, db.truncate(0)) + require.NoError(t, db.Close()) + + // Create a new storage and see what nextRef is initialized to. + db, err = Open(log.NewNopLogger(), nil, rs, dbDir, DefaultOptions()) + require.NoError(t, err) + defer require.NoError(t, db.Close()) + + require.Equal(t, uint64(seriesCount), db.nextRef.Load(), "nextRef should be equal to the number of series written across the entire WAL") +} + func startTime() (int64, error) { return time.Now().Unix() * 1000, nil } From 4d8b77546dfb2bdf86cd5e48b1494028bb1e3bad Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Thu, 14 Apr 2022 15:05:26 +0200 Subject: [PATCH 08/11] Changelog: add missing enhancement (#10593) Signed-off-by: Julien Pivotto --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e305ea26..f0b74e3e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Enable with the flag `--enable-feature=per-step-stats` #10369 * [ENHANCEMENT] Azure SD: Add metric to track Azure SD failures #10476 * [ENHANCEMENT] Azure SD: Add an optional `resource_group` configuration. #10365 * [ENHANCEMENT] Kubernetes SD: Support `discovery.k8s.io/v1` `EndpointSlice` (previously only `discovery.k8s.io/v1beta1` `EndpointSlice` was supported). #9570 +* [ENHANCEMENT] Kubernetes SD: Allow attaching node metadata to discovered pods. #10080 * [ENHANCEMENT] OAuth2: Support for using a proxy URL to fetch OAuth2 tokens. #10492 * [ENHANCEMENT] Configuration: Add the ability to disable HTTP2. #10492 * [BUGFIX] Kubernetes SD: Explicitly include gcp auth from k8s.io. #10516 From db8c550570b7b8b14873b2f79b60cadb41490c83 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Thu, 14 Apr 2022 15:18:46 +0200 Subject: [PATCH 09/11] Revoke storing target and metadata cache in context. (#10590) Storing the scrape cache and the target (which also contains that cache) is apparently causing hige memory increase. I think me might not control the lifespan of the context enough, therefore old objects keep living in memory for longer than needed. Let's unblock the release and look for an alternative so that downstream consumers can get access to that data. Signed-off-by: Julien Pivotto --- scrape/scrape.go | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/scrape/scrape.go b/scrape/scrape.go index 5447870cc..09e7aae36 100644 --- a/scrape/scrape.go +++ b/scrape/scrape.go @@ -298,12 +298,8 @@ func newScrapePool(cfg *config.ScrapeConfig, app storage.Appendable, jitterSeed } opts.target.SetMetadataStore(cache) - // Store the cache in the context. - loopCtx := ContextWithMetricMetadataStore(ctx, cache) - loopCtx = ContextWithTarget(loopCtx, opts.target) - return newScrapeLoop( - loopCtx, + ctx, opts.scraper, log.With(logger, "target", opts.target), buffers, @@ -1795,31 +1791,3 @@ func reusableCache(r, l *config.ScrapeConfig) bool { } return reflect.DeepEqual(zeroConfig(r), zeroConfig(l)) } - -// CtxKey is a dedicated type for keys of context-embedded values propagated -// with the scrape context. -type ctxKey int - -// Valid CtxKey values. -const ( - ctxKeyMetadata ctxKey = iota + 1 - ctxKeyTarget -) - -func ContextWithMetricMetadataStore(ctx context.Context, s MetricMetadataStore) context.Context { - return context.WithValue(ctx, ctxKeyMetadata, s) -} - -func MetricMetadataStoreFromContext(ctx context.Context) (MetricMetadataStore, bool) { - s, ok := ctx.Value(ctxKeyMetadata).(MetricMetadataStore) - return s, ok -} - -func ContextWithTarget(ctx context.Context, t *Target) context.Context { - return context.WithValue(ctx, ctxKeyTarget, t) -} - -func TargetFromContext(ctx context.Context) (*Target, bool) { - t, ok := ctx.Value(ctxKeyTarget).(*Target) - return t, ok -} From b4d0dcb6e8a1f16beb74059f537ac510f5439788 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Thu, 14 Apr 2022 12:44:02 +0200 Subject: [PATCH 10/11] Tracing/GRPC: Set TLS credentials only when insecure is false. Fixes #10542 Signed-off-by: Julien Pivotto --- tracing/tracing.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tracing/tracing.go b/tracing/tracing.go index c82332065..f5ec28955 100644 --- a/tracing/tracing.go +++ b/tracing/tracing.go @@ -183,6 +183,14 @@ func getClient(tracingCfg config.TracingConfig) (otlptrace.Client, error) { opts := []otlptracegrpc.Option{otlptracegrpc.WithEndpoint(tracingCfg.Endpoint)} if tracingCfg.Insecure { opts = append(opts, otlptracegrpc.WithInsecure()) + } else { + // Use of TLS Credentials forces the use of TLS. Therefore it can + // only be set when `insecure` is set to false. + tlsConf, err := config_util.NewTLSConfig(&tracingCfg.TLSConfig) + if err != nil { + return nil, err + } + opts = append(opts, otlptracegrpc.WithTLSCredentials(credentials.NewTLS(tlsConf))) } if tracingCfg.Compression != "" { opts = append(opts, otlptracegrpc.WithCompressor(tracingCfg.Compression)) @@ -194,12 +202,6 @@ func getClient(tracingCfg config.TracingConfig) (otlptrace.Client, error) { opts = append(opts, otlptracegrpc.WithTimeout(time.Duration(tracingCfg.Timeout))) } - tlsConf, err := config_util.NewTLSConfig(&tracingCfg.TLSConfig) - if err != nil { - return nil, err - } - opts = append(opts, otlptracegrpc.WithTLSCredentials(credentials.NewTLS(tlsConf))) - client = otlptracegrpc.NewClient(opts...) case config.TracingClientHTTP: opts := []otlptracehttp.Option{otlptracehttp.WithEndpoint(tracingCfg.Endpoint)} From 5b80eaa3ca27beb3a831c460edaf53ac4e47c610 Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Thu, 14 Apr 2022 16:41:28 +0200 Subject: [PATCH 11/11] cut v2.35.0-rc1 (#10596) * cut v2.35.0-rc1 Signed-off-by: Augustin Husson --- CHANGELOG.md | 7 +++++++ VERSION | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0b74e3e8..ca8f961c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2.35.0-rc1 / 2022-04-14 + +* [ENHANCEMENT] Update package `uber.go/auomaxprocs` to support `cgroups2` #10584 +* [BUGFIX] Tracing/GRPC: Set TLS credentials only when insecure is false. #10592 +* [BUGFIX] Agent: Fix ID collision when loading a WAL with multiple segments. #10587 +* [BUGFIX] Revoke storing target and metadata cache in context. This can fix a memory link introduced in `2.35.0-rc0` #10590 + ## 2.35.0-rc0 / 2022-04-08 * [CHANGE] TSDB: Delete `*.tmp` WAL files when Prometheus starts. #10317 diff --git a/VERSION b/VERSION index 044037b8c..925692b07 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.35.0-rc0 +2.35.0-rc1