Skip to content

Commit 660663a

Browse files
authored
Merge branch 'main' into expfmt-benchmark
2 parents 812e482 + 62e9d0f commit 660663a

42 files changed

Lines changed: 994 additions & 291 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,35 @@ updates:
33
- package-ecosystem: "gomod"
44
directory: "/"
55
schedule:
6-
interval: monthly
7-
- package-ecosystem: "gomod"
8-
directory: "/assets"
6+
interval: "monthly"
7+
groups:
8+
aws:
9+
patterns:
10+
- "github.com/aws/*"
11+
go.opentelemetry.io:
12+
patterns:
13+
- "go.opentelemetry.io/*"
14+
golang.org-x:
15+
patterns:
16+
- "golang.org/x/*"
17+
k8s.io:
18+
patterns:
19+
- "k8s.io/*"
20+
- package-ecosystem: "github-actions"
21+
directory: "/"
922
schedule:
10-
interval: monthly
23+
interval: "monthly"
24+
groups:
25+
promci:
26+
patterns:
27+
- "prometheus/promci*"
28+
codeql:
29+
patterns:
30+
- "github/codeql-action*"
31+
# Exclude configs synced from upstream prometheus/prometheus.
32+
exclude-paths:
33+
- .github/workflows/container_description.yml
34+
- .github/workflows/golangci-lint.yml
35+
- .github/workflows/govulncheck.yml
36+
- .github/workflows/scorecards.yml
37+
- .github/workflows/stale.yml

.github/workflows/golangci-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout repository
29-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3030
with:
3131
persist-credentials: false
3232
- name: Install Go
33-
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
33+
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
3434
with:
3535
go-version: 1.26.x
3636
- name: Install snmp_exporter/generator dependencies
@@ -40,7 +40,7 @@ jobs:
4040
id: golangci-lint-version
4141
run: echo "version=$(make print-golangci-lint-version)" >> $GITHUB_OUTPUT
4242
- name: Lint
43-
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
43+
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
4444
with:
4545
args: --verbose
4646
version: ${{ steps.golangci-lint-version.outputs.version }}

.github/workflows/govulncheck.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: govulncheck
3+
on:
4+
pull_request:
5+
paths:
6+
- VERSION
7+
- .github/workflows/govulncheck.yml
8+
push:
9+
branches:
10+
- main
11+
- master
12+
schedule:
13+
- cron: '33 2 * * *'
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
govulncheck:
20+
runs-on: ubuntu-latest
21+
name: Run govulncheck
22+
steps:
23+
- name: Install snmp_exporter/generator dependencies
24+
id: snmp-deps
25+
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
26+
if: github.repository == 'prometheus/snmp_exporter'
27+
- id: govulncheck
28+
uses: golang/govulncheck-action@3fa7bd9cee2cfdf3499a8803b226e43de7b7cdb4 # master
29+
env:
30+
GOOS: ${{ contains(github.repository, 'windows_exporter') && 'windows' || '' }}

.golangci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ linters:
1111
- govet
1212
- loggercheck
1313
- misspell
14+
- modernize
1415
- nilnesserr
1516
# TODO(bwplotka): Enable once https://github.com/golangci/golangci-lint/issues/3228 is fixed.
1617
# - nolintlint
@@ -43,6 +44,9 @@ linters:
4344
- linters:
4445
- gocritic
4546
text: "appendAssign"
47+
- linters:
48+
- errcheck
49+
path: _test.go
4650
warn-unused: true
4751
settings:
4852
depguard:
@@ -77,6 +81,15 @@ linters:
7781
- shadow
7882
- fieldalignment
7983
enable-all: true
84+
modernize:
85+
disable:
86+
# Suggest replacing omitempty with omitzero for struct fields.
87+
# Disable this check for now since it introduces too many changes in our existing codebase.
88+
# See https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/modernize#hdr-Analyzer_omitzero for more details.
89+
- omitzero
90+
# Disable newexpr check for now since it introduces too many changes in our existing codebase.
91+
# To be re-enabled as a part of https://github.com/prometheus/prometheus/issues/18066.
92+
- newexpr
8093
perfsprint:
8194
# Optimizes even if it requires an int or uint type cast.
8295
int-conversion: true

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@
44

55
### What's Changed
66

7+
## v0.69.0 / 2026-06-17
8+
9+
### Security / behavior changes
10+
11+
* **config: credentials are no longer forwarded across cross-host redirects.** When `FollowRedirects` is enabled, the HTTP client now strips `Authorization`, `Cookie`, `Proxy-Authorization` and other sensitive headers, and skips basic-auth, bearer-token and OAuth2 credentials, when a redirect points to a different host. This aligns with Go's `net/http` behavior. Callers that relied on credentials being sent to a redirect target on another host will need to target that host directly. #901 #920 #921
12+
* config: `LoadHTTPConfigFile` now resolves relative file paths (e.g. `*_file` credentials, `http_headers` files) against the config file's own directory instead of its parent directory. Configs that worked around the old behavior by prefixing paths with the config's directory name must drop that prefix. #925
13+
14+
### Bugfixes
15+
16+
* expfmt: fix nil pointer panic when parsing empty braces `{}`. #922
17+
* model: fix `Time.UnmarshalJSON` for larger negative numbers. #918
18+
19+
### Performance
20+
21+
* model: reduce allocations in `Time.UnmarshalJSON`. #918
22+
23+
### Internal
24+
25+
* Synchronize common files from prometheus/prometheus. #917
26+
* Modernize Go. #919
27+
28+
**Full Changelog**: https://github.com/prometheus/common/compare/v0.68.1...v0.69.0
29+
730
## v0.67.2 / 2025-10-28
831

932
## What's Changed

Makefile.common

Lines changed: 4 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ ifneq ($(shell command -v gotestsum 2> /dev/null),)
5555
endif
5656
endif
5757

58-
PROMU_VERSION ?= 0.18.0
58+
PROMU_VERSION ?= 0.20.0
5959
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
6060

6161
SKIP_GOLANGCI_LINT :=
6262
GOLANGCI_LINT :=
6363
GOLANGCI_LINT_OPTS ?=
64-
GOLANGCI_LINT_VERSION ?= v2.10.1
64+
GOLANGCI_LINT_VERSION ?= v2.11.4
6565
GOLANGCI_FMT_OPTS ?=
6666
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
6767
# windows isn't included here because of the path separator being different.
@@ -90,8 +90,8 @@ ifdef DOCKERFILE_PATH
9090
$(error DOCKERFILE_PATH is deprecated. Use DOCKERFILE_VARIANTS ?= $(DOCKERFILE_PATH) in the Makefile)
9191
endif
9292

93-
DOCKER_ARCHS ?= amd64
94-
DOCKERFILE_VARIANTS ?= Dockerfile $(wildcard Dockerfile.*)
93+
DOCKER_ARCHS ?= amd64 arm64 armv7 ppc64le riscv64 s390x
94+
DOCKERFILE_VARIANTS ?= $(wildcard Dockerfile Dockerfile.*)
9595

9696
# Function to extract variant from Dockerfile label.
9797
# Returns the variant name from io.prometheus.image.variant label, or "default" if not found.
@@ -109,24 +109,6 @@ endif
109109
# Build variant:dockerfile pairs for shell iteration.
110110
DOCKERFILE_VARIANTS_WITH_NAMES := $(foreach df,$(DOCKERFILE_VARIANTS),$(call dockerfile_variant,$(df)):$(df))
111111

112-
# Shell helper to check whether a dockerfile/arch pair is excluded.
113-
define dockerfile_arch_is_excluded
114-
case " $(DOCKERFILE_ARCH_EXCLUSIONS) " in \
115-
*" $$dockerfile:$(1) "*) true ;; \
116-
*) false ;; \
117-
esac
118-
endef
119-
120-
# Shell helper to check whether a registry/arch pair is excluded.
121-
# Extracts registry from DOCKER_REPO (e.g., quay.io/prometheus -> quay.io)
122-
define registry_arch_is_excluded
123-
registry=$$(echo "$(DOCKER_REPO)" | cut -d'/' -f1); \
124-
case " $(DOCKER_REGISTRY_ARCH_EXCLUSIONS) " in \
125-
*" $$registry:$(1) "*) true ;; \
126-
*) false ;; \
127-
esac
128-
endef
129-
130112
BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS))
131113
PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS))
132114
TAG_DOCKER_ARCHS = $(addprefix common-docker-tag-latest-,$(DOCKER_ARCHS))
@@ -268,10 +250,6 @@ $(BUILD_DOCKER_ARCHS): common-docker-%:
268250
@for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \
269251
dockerfile=$${variant#*:}; \
270252
variant_name=$${variant%%:*}; \
271-
if $(call dockerfile_arch_is_excluded,$*); then \
272-
echo "Skipping $$variant_name variant for linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
273-
continue; \
274-
fi; \
275253
distroless_arch="$*"; \
276254
if [ "$*" = "armv7" ]; then \
277255
distroless_arch="arm"; \
@@ -306,14 +284,6 @@ $(PUBLISH_DOCKER_ARCHS): common-docker-publish-%:
306284
@for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \
307285
dockerfile=$${variant#*:}; \
308286
variant_name=$${variant%%:*}; \
309-
if $(call dockerfile_arch_is_excluded,$*); then \
310-
echo "Skipping push for $$variant_name variant on linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
311-
continue; \
312-
fi; \
313-
if $(call registry_arch_is_excluded,$*); then \
314-
echo "Skipping push for $$variant_name variant on linux-$* to $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
315-
continue; \
316-
fi; \
317287
if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \
318288
echo "Pushing $$variant_name variant for linux-$*"; \
319289
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \
@@ -341,14 +311,6 @@ $(TAG_DOCKER_ARCHS): common-docker-tag-latest-%:
341311
@for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \
342312
dockerfile=$${variant#*:}; \
343313
variant_name=$${variant%%:*}; \
344-
if $(call dockerfile_arch_is_excluded,$*); then \
345-
echo "Skipping tag for $$variant_name variant on linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
346-
continue; \
347-
fi; \
348-
if $(call registry_arch_is_excluded,$*); then \
349-
echo "Skipping tag for $$variant_name variant on linux-$* for $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
350-
continue; \
351-
fi; \
352314
if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \
353315
echo "Tagging $$variant_name variant for linux-$* as latest"; \
354316
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest-$$variant_name"; \
@@ -370,14 +332,6 @@ common-docker-manifest:
370332
echo "Creating manifest for $$variant_name variant"; \
371333
refs=""; \
372334
for arch in $(DOCKER_ARCHS); do \
373-
if $(call dockerfile_arch_is_excluded,$$arch); then \
374-
echo " Skipping $$arch for $$variant_name (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
375-
continue; \
376-
fi; \
377-
if $(call registry_arch_is_excluded,$$arch); then \
378-
echo " Skipping $$arch for $$variant_name on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
379-
continue; \
380-
fi; \
381335
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \
382336
done; \
383337
if [ -z "$$refs" ]; then \
@@ -391,14 +345,6 @@ common-docker-manifest:
391345
echo "Creating default variant ($$variant_name) manifest"; \
392346
refs=""; \
393347
for arch in $(DOCKER_ARCHS); do \
394-
if $(call dockerfile_arch_is_excluded,$$arch); then \
395-
echo " Skipping $$arch for default variant (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
396-
continue; \
397-
fi; \
398-
if $(call registry_arch_is_excluded,$$arch); then \
399-
echo " Skipping $$arch for default variant on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
400-
continue; \
401-
fi; \
402348
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:$(SANITIZED_DOCKER_IMAGE_TAG)"; \
403349
done; \
404350
if [ -z "$$refs" ]; then \
@@ -413,14 +359,6 @@ common-docker-manifest:
413359
echo "Creating manifest for $$variant_name variant version tag"; \
414360
refs=""; \
415361
for arch in $(DOCKER_ARCHS); do \
416-
if $(call dockerfile_arch_is_excluded,$$arch); then \
417-
echo " Skipping $$arch for $$variant_name version tag (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
418-
continue; \
419-
fi; \
420-
if $(call registry_arch_is_excluded,$$arch); then \
421-
echo " Skipping $$arch for $$variant_name version tag on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
422-
continue; \
423-
fi; \
424362
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name"; \
425363
done; \
426364
if [ -z "$$refs" ]; then \
@@ -434,14 +372,6 @@ common-docker-manifest:
434372
echo "Creating default variant version tag manifest"; \
435373
refs=""; \
436374
for arch in $(DOCKER_ARCHS); do \
437-
if $(call dockerfile_arch_is_excluded,$$arch); then \
438-
echo " Skipping $$arch for default variant version tag (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
439-
continue; \
440-
fi; \
441-
if $(call registry_arch_is_excluded,$$arch); then \
442-
echo " Skipping $$arch for default variant version tag on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
443-
continue; \
444-
fi; \
445375
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:v$(DOCKER_MAJOR_VERSION_TAG)"; \
446376
done; \
447377
if [ -z "$$refs" ]; then \
@@ -495,9 +425,3 @@ $(1)_precheck:
495425
exit 1; \
496426
fi
497427
endef
498-
499-
govulncheck: install-govulncheck
500-
govulncheck ./...
501-
502-
install-govulncheck:
503-
command -v govulncheck > /dev/null || go install golang.org/x/vuln/cmd/govulncheck@latest

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
The Prometheus security policy, including how to report vulnerabilities, can be
44
found here:
55

6-
<https://prometheus.io/docs/operating/security/>
6+
[https://prometheus.io/docs/operating/security/](https://prometheus.io/docs/operating/security/)

config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Secret string
3333
var MarshalSecretValue = false
3434

3535
// MarshalYAML implements the yaml.Marshaler interface for Secrets.
36-
func (s Secret) MarshalYAML() (interface{}, error) {
36+
func (s Secret) MarshalYAML() (any, error) {
3737
if MarshalSecretValue {
3838
return string(s), nil
3939
}
@@ -44,7 +44,7 @@ func (s Secret) MarshalYAML() (interface{}, error) {
4444
}
4545

4646
// UnmarshalYAML implements the yaml.Unmarshaler interface for Secrets.
47-
func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error {
47+
func (s *Secret) UnmarshalYAML(unmarshal func(any) error) error {
4848
type plain Secret
4949
return unmarshal((*plain)(s))
5050
}

0 commit comments

Comments
 (0)