Skip to content

Commit 8bb0edd

Browse files
authored
Merge branch 'master' into fix/close-everything
Signed-off-by: Sam DeHaan <dehaansa@gmail.com>
2 parents 743b06f + aa98bb3 commit 8bb0edd

Some content is hidden

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

56 files changed

+2016
-483
lines changed

.circleci/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ executors:
88
# This must match .promu.yml.
99
golang:
1010
docker:
11-
- image: cimg/go:1.21
11+
- image: cimg/go:1.24
1212

1313
jobs:
1414
test:
@@ -23,7 +23,7 @@ jobs:
2323

2424
integration:
2525
docker:
26-
- image: cimg/go:1.20
26+
- image: cimg/go:1.24
2727
- image: << parameters.postgres_image >>
2828
environment:
2929
POSTGRES_DB: circle_test
@@ -63,6 +63,7 @@ workflows:
6363
- cimg/postgres:14.9
6464
- cimg/postgres:15.4
6565
- cimg/postgres:16.0
66+
- cimg/postgres:17.0
6667
- prometheus/build:
6768
name: build
6869
parallelism: 3
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: Push README to Docker Hub
3+
on:
4+
push:
5+
paths:
6+
- "README.md"
7+
- "README-containers.md"
8+
- ".github/workflows/container_description.yml"
9+
branches: [ main, master ]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
PushDockerHubReadme:
16+
runs-on: ubuntu-latest
17+
name: Push README to Docker Hub
18+
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
19+
steps:
20+
- name: git checkout
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
with:
23+
persist-credentials: false
24+
- name: Set docker hub repo name
25+
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
26+
- name: Push README to Dockerhub
27+
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
28+
env:
29+
DOCKER_USER: ${{ secrets.DOCKER_HUB_LOGIN }}
30+
DOCKER_PASS: ${{ secrets.DOCKER_HUB_PASSWORD }}
31+
with:
32+
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
33+
provider: dockerhub
34+
short_description: ${{ env.DOCKER_REPO_NAME }}
35+
# Empty string results in README-containers.md being pushed if it
36+
# exists. Otherwise, README.md is pushed.
37+
readme_file: ''
38+
39+
PushQuayIoReadme:
40+
runs-on: ubuntu-latest
41+
name: Push README to quay.io
42+
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
43+
steps:
44+
- name: git checkout
45+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46+
with:
47+
persist-credentials: false
48+
- name: Set quay.io org name
49+
run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV
50+
- name: Set quay.io repo name
51+
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
52+
- name: Push README to quay.io
53+
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
54+
env:
55+
DOCKER_APIKEY: ${{ secrets.QUAY_IO_API_TOKEN }}
56+
with:
57+
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
58+
provider: quay
59+
# Empty string results in README-containers.md being pushed if it
60+
# exists. Otherwise, README.md is pushed.
61+
readme_file: ''

.github/workflows/golangci-lint.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,30 @@ on:
1212
- ".golangci.yml"
1313
pull_request:
1414

15+
permissions: # added using https://github.com/step-security/secure-repo
16+
contents: read
17+
1518
jobs:
1619
golangci:
20+
permissions:
21+
contents: read # for actions/checkout to fetch code
22+
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
1723
name: lint
1824
runs-on: ubuntu-latest
1925
steps:
2026
- name: Checkout repository
21-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
22-
- name: install Go
23-
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
persist-credentials: false
30+
- name: Install Go
31+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
2432
with:
25-
go-version: 1.21.x
33+
go-version: 1.24.x
2634
- name: Install snmp_exporter/generator dependencies
2735
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
2836
if: github.repository == 'prometheus/snmp_exporter'
2937
- name: Lint
30-
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
38+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
3139
with:
32-
version: v1.54.2
40+
args: --verbose
41+
version: v2.2.1

.golangci.yml

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
1-
---
1+
version: "2"
22
linters:
33
enable:
4-
- misspell
5-
- revive
6-
7-
issues:
8-
exclude-rules:
9-
- path: _test.go
10-
linters:
11-
- errcheck
12-
13-
linters-settings:
14-
errcheck:
15-
exclude-functions:
16-
# Never check for logger errors.
17-
- (github.com/go-kit/log.Logger).Log
18-
revive:
4+
- misspell
5+
- revive
6+
settings:
7+
errcheck:
8+
exclude-functions:
9+
- (github.com/go-kit/log.Logger).Log
10+
revive:
11+
rules:
12+
- name: unused-parameter
13+
severity: warning
14+
disabled: true
15+
exclusions:
16+
generated: lax
17+
presets:
18+
- comments
19+
- common-false-positives
20+
- legacy
21+
- std-error-handling
1922
rules:
20-
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
21-
- name: unused-parameter
22-
severity: warning
23-
disabled: true
23+
- linters:
24+
- errcheck
25+
path: _test.go
26+
paths:
27+
- third_party$
28+
- builtin$
29+
- examples$
30+
formatters:
31+
exclusions:
32+
generated: lax
33+
paths:
34+
- third_party$
35+
- builtin$
36+
- examples$

.promu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
go:
22
# This must match .circle/config.yml.
3-
version: 1.21
3+
version: 1.24
44
repository:
55
path: github.com/prometheus-community/postgres_exporter
66
build:

.yamllint

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
extends: default
3+
ignore: |
4+
**/node_modules
35

46
rules:
57
braces:

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
## 0.17.1 / 2025-02-26
2+
3+
* [BUGFIX] Fix: Handle incoming labels with invalid UTF-8 #1131
4+
5+
## 0.17.0 / 2025-02-16
6+
7+
## What's Changed
8+
* [ENHANCEMENT] Add Postgres 17 for CI test by @khiemdoan in https://github.com/prometheus-community/postgres_exporter/pull/1105
9+
* [ENHANCEMENT] Add wait/backend to pg_stat_activity by @fgalind1 in https://github.com/prometheus-community/postgres_exporter/pull/1106
10+
* [ENHANCEMENT] Export last replay age in replication collector by @bitfehler in https://github.com/prometheus-community/postgres_exporter/pull/1085
11+
* [BUGFIX] Fix pg_long_running_transactions time by @jyothikirant-sayukth in https://github.com/prometheus-community/postgres_exporter/pull/1092
12+
* [BUGFIX] Fix to replace dashes with underscore in the metric names by @aagarwalla-fx in https://github.com/prometheus-community/postgres_exporter/pull/1103
13+
* [BIGFIX] Checkpoint related columns in PG 17 have been moved from pg_stat_bgwriter to pg_stat_checkpointer by @n-rodriguez in https://github.com/prometheus-community/postgres_exporter/pull/1072
14+
* [BUGFIX] Fix pg_stat_statements for PG17 by @NevermindZ4 in https://github.com/prometheus-community/postgres_exporter/pull/1114
15+
* [BUGFIX] Handle pg_replication_slots on pg<13 by @michael-todorovic in https://github.com/prometheus-community/postgres_exporter/pull/1098
16+
* [BUGFIX] Fix missing dsn sanitization for logging by @sysadmind in https://github.com/prometheus-community/postgres_exporter/pull/1104
17+
18+
## New Contributors
19+
* @jyothikirant-sayukth made their first contribution in https://github.com/prometheus-community/postgres_exporter/pull/1092
20+
* @aagarwalla-fx made their first contribution in https://github.com/prometheus-community/postgres_exporter/pull/1103
21+
* @NevermindZ4 made their first contribution in https://github.com/prometheus-community/postgres_exporter/pull/1114
22+
* @michael-todorovic made their first contribution in https://github.com/prometheus-community/postgres_exporter/pull/1098
23+
* @fgalind1 made their first contribution in https://github.com/prometheus-community/postgres_exporter/pull/1106
24+
25+
**Full Changelog**: https://github.com/prometheus-community/postgres_exporter/compare/v0.16.0...v0.17.0
26+
27+
## 0.16.0 / 2024-11-10
28+
29+
BREAKING CHANGES:
30+
31+
The logging system has been replaced with log/slog from the stdlib. This change is being made across the prometheus ecosystem. The logging output has changed, but the messages and levels remain the same. The `ts` label for the timestamp has bewen replaced with `time`, the accuracy is less, and the timezone is not forced to UTC. The `caller` field has been replaced by the `source` field, which now includes the full path to the source file. The `level` field now exposes the log level in capital letters.
32+
33+
* [CHANGE] Replace logging system #1073
34+
* [ENHANCEMENT] Add save_wal_size and wal_status to replication_slot collector #1027
35+
* [ENHANCEMENT] Add roles collector and connection limit metrics to database collector #997
36+
* [ENHANCEMENT] Excluded databases log messgae is now info level #1003
37+
* [ENHANCEMENT] Add active_time to stat_database collector #961
38+
* [ENHANCEMENT] Add slot_type label to replication_slot collector #960
39+
* [BUGFIX] Fix walreceiver collectore when no repmgr #1086
40+
* [BUGFIX] Remove logging errors on replicas #1048
41+
* [BUGFIX] Fix active_time query on postgres>=14 #1045
42+
143
## 0.15.0 / 2023-10-27
244

345
* [ENHANCEMENT] Add 1kB and 2kB units #915

Makefile.common

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,24 @@ endif
4949
GOTEST := $(GO) test
5050
GOTEST_DIR :=
5151
ifneq ($(CIRCLE_JOB),)
52-
ifneq ($(shell command -v gotestsum > /dev/null),)
52+
ifneq ($(shell command -v gotestsum 2> /dev/null),)
5353
GOTEST_DIR := test-results
5454
GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml --
5555
endif
5656
endif
5757

58-
PROMU_VERSION ?= 0.15.0
58+
PROMU_VERSION ?= 0.17.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 ?= v1.55.2
65-
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
64+
GOLANGCI_LINT_VERSION ?= v2.2.1
65+
GOLANGCI_FMT_OPTS ?=
66+
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
6667
# windows isn't included here because of the path separator being different.
6768
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
68-
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
69+
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386 arm64))
6970
# If we're in CI and there is an Actions file, that means the linter
7071
# is being run in Actions, so we don't need to run it here.
7172
ifneq (,$(SKIP_GOLANGCI_LINT))
@@ -138,7 +139,7 @@ common-deps:
138139
update-go-deps:
139140
@echo ">> updating Go dependencies"
140141
@for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
141-
$(GO) get -d $$m; \
142+
$(GO) get $$m; \
142143
done
143144
$(GO) mod tidy
144145

@@ -156,9 +157,13 @@ $(GOTEST_DIR):
156157
@mkdir -p $@
157158

158159
.PHONY: common-format
159-
common-format:
160+
common-format: $(GOLANGCI_LINT)
160161
@echo ">> formatting code"
161162
$(GO) fmt $(pkgs)
163+
ifdef GOLANGCI_LINT
164+
@echo ">> formatting code with golangci-lint"
165+
$(GOLANGCI_LINT) fmt $(GOLANGCI_FMT_OPTS)
166+
endif
162167

163168
.PHONY: common-vet
164169
common-vet:
@@ -169,16 +174,20 @@ common-vet:
169174
common-lint: $(GOLANGCI_LINT)
170175
ifdef GOLANGCI_LINT
171176
@echo ">> running golangci-lint"
172-
# 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
173-
# Otherwise staticcheck might fail randomly for some reason not yet explained.
174-
$(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
175177
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
176178
endif
177179

180+
.PHONY: common-lint-fix
181+
common-lint-fix: $(GOLANGCI_LINT)
182+
ifdef GOLANGCI_LINT
183+
@echo ">> running golangci-lint fix"
184+
$(GOLANGCI_LINT) run --fix $(GOLANGCI_LINT_OPTS) $(pkgs)
185+
endif
186+
178187
.PHONY: common-yamllint
179188
common-yamllint:
180189
@echo ">> running yamllint on all YAML files in the repository"
181-
ifeq (, $(shell command -v yamllint > /dev/null))
190+
ifeq (, $(shell command -v yamllint 2> /dev/null))
182191
@echo "yamllint not installed so skipping"
183192
else
184193
yamllint .
@@ -204,6 +213,10 @@ common-tarball: promu
204213
@echo ">> building release tarball"
205214
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
206215

216+
.PHONY: common-docker-repo-name
217+
common-docker-repo-name:
218+
@echo "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)"
219+
207220
.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
208221
common-docker: $(BUILD_DOCKER_ARCHS)
209222
$(BUILD_DOCKER_ARCHS): common-docker-%:
@@ -240,8 +253,8 @@ $(PROMU):
240253
cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu
241254
rm -r $(PROMU_TMP)
242255

243-
.PHONY: proto
244-
proto:
256+
.PHONY: common-proto
257+
common-proto:
245258
@echo ">> generating code from proto files"
246259
@./scripts/genproto.sh
247260

@@ -267,3 +280,9 @@ $(1)_precheck:
267280
exit 1; \
268281
fi
269282
endef
283+
284+
govulncheck: install-govulncheck
285+
govulncheck ./...
286+
287+
install-govulncheck:
288+
command -v govulncheck > /dev/null || go install golang.org/x/vuln/cmd/govulncheck@latest

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
Prometheus exporter for PostgreSQL server metrics.
99

10-
CI Tested PostgreSQL versions: `11`, `12`, `13`, `14`, `15`, `16`
10+
CI Tested PostgreSQL versions: `11`, `12`, `13`, `14`, `15`, `16`, `17`.
1111

1212
## Quick Start
1313
This package is available for Docker:
@@ -144,9 +144,18 @@ This will build the docker image as `prometheuscommunity/postgres_exporter:${bra
144144
* `[no-]collector.stat_database`
145145
Enable the `stat_database` collector (default: enabled).
146146

147+
* `[no-]collector.stat_progress_vacuum`
148+
Enable the `stat_progress_vacuum` collector (default: enabled).
149+
147150
* `[no-]collector.stat_statements`
148151
Enable the `stat_statements` collector (default: disabled).
149152

153+
* `[no-]collector.stat_statements.include_query`
154+
Enable selecting statement query together with queryId. (default: disabled)
155+
156+
* `--collector.stat_statements.query_length`
157+
Maximum length of the statement text. Default is 120.
158+
150159
* `[no-]collector.stat_user_tables`
151160
Enable the `stat_user_tables` collector (default: enabled).
152161

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.15.0
1+
0.17.1

0 commit comments

Comments
 (0)