Skip to content

Commit 29a9643

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents e80c918 + a95b518 commit 29a9643

File tree

17 files changed

+109
-79
lines changed

17 files changed

+109
-79
lines changed

.circleci/config.yml

Lines changed: 7 additions & 9 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.24
11+
- image: cimg/go:1.25
1212

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

2424
integration:
2525
docker:
26-
- image: cimg/go:1.24
26+
- image: cimg/go:1.25
2727
- image: << parameters.postgres_image >>
2828
environment:
2929
POSTGRES_DB: circle_test
@@ -57,13 +57,11 @@ workflows:
5757
matrix:
5858
parameters:
5959
postgres_image:
60-
- circleci/postgres:11
61-
- circleci/postgres:12
62-
- circleci/postgres:13
63-
- cimg/postgres:14.9
64-
- cimg/postgres:15.4
65-
- cimg/postgres:16.0
66-
- cimg/postgres:17.0
60+
- cimg/postgres:13.22
61+
- cimg/postgres:14.19
62+
- cimg/postgres:15.14
63+
- cimg/postgres:16.10
64+
- cimg/postgres:17.6
6765
- prometheus/build:
6866
name: build
6967
parallelism: 3

.github/workflows/golangci-lint.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ jobs:
3434
- name: Install Go
3535
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
3636
with:
37-
go-version: 1.24.x
37+
go-version: 1.25.x
3838
- name: Install snmp_exporter/generator dependencies
3939
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
4040
if: github.repository == 'prometheus/snmp_exporter'
41+
- name: Get golangci-lint version
42+
id: golangci-lint-version
43+
run: echo "version=$(make print-golangci-lint-version)" >> $GITHUB_OUTPUT
4144
- name: Lint
4245
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
4346
with:
4447
args: --verbose
45-
version: v2.2.1
48+
version: ${{ steps.golangci-lint-version.outputs.version }}

.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.24
3+
version: 1.25
44
repository:
55
path: github.com/prometheus-community/postgres_exporter
66
build:

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
## main / (unreleased)
2+
3+
* [CHANGE] ...
4+
* [FEATURE] ...
5+
* [ENHANCEMENT] ...
6+
* [BUGFIX] ...
7+
8+
## 0.18.1 / 2025-09-29
9+
10+
* [BUGFIX] Fix swapped `flushedLsn` and `receiveStartTli` for `wal_receiver` collector by @spantaleev in https://github.com/prometheus-community/postgres_exporter/pull/1198
11+
* [BUGFIX] Fix superfluous semicolon breaking query in `process_idle` by @sysadmind in https://github.com/prometheus-community/postgres_exporter/pull/1197 and https://github.com/prometheus-community/postgres_exporter/pull/1201
12+
13+
## 0.18.0 / 2025-09-25
14+
15+
* [FEATURE] Add `stat_progress_vacuum` collector by @ianbibby in https://github.com/prometheus-community/postgres_exporter/pull/1141
16+
* [FEATURE] Add `buffercache_summary` collector by @sfc-gh-pnuttall in https://github.com/prometheus-community/postgres_exporter/pull/1165
17+
* [FEATURE] `stat_statements`: export query itself together with `queryId` by @Delorien84 in https://github.com/prometheus-community/postgres_exporter/pull/940
18+
* [ENHANCEMENT] Improve error handling for `Server.Scrape` by @BoweFlex in https://github.com/prometheus-community/postgres_exporter/pull/1158
19+
* [ENHANCEMENT] `stat_user_tables`: record table-only size bytes in addition to the total size bytes by @Sticksman Sticksman in https://github.com/prometheus-community/postgres_exporter/pull/1149
20+
* [ENHANCEMENT] (chore) Fix a typo and use `slices.Contains` by @cristiangreco in https://github.com/prometheus-community/postgres_exporter/pull/1176
21+
* [ENHANCEMENT] Update mixin to latest changes from `grafana/postgres_exporter` by @cristiangreco, @gaantunes, @v-zhuravlev and @mshahzeb in https://github.com/prometheus-community/postgres_exporter/pull/1179
22+
* [ENHANCEMENT] Exclude the metrics fetching session's data from pg_stat_activity by @kmoppel in https://github.com/prometheus-community/postgres_exporter/pull/1185
23+
* [BUGFIX] Ensure database connections are always closed by @cristiangreco and @dehaansa in https://github.com/prometheus-community/postgres_exporter/pull/1177
24+
* [BUGFIX] Fix superfluous semicolon breaking query in `process_idle` by @sysadmind in https://github.com/prometheus-community/postgres_exporter/pull/1197
25+
126
## 0.17.1 / 2025-02-26
227

328
* [BUGFIX] Fix: Handle incoming labels with invalid UTF-8 #1131

Makefile.common

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
6161
SKIP_GOLANGCI_LINT :=
6262
GOLANGCI_LINT :=
6363
GOLANGCI_LINT_OPTS ?=
64-
GOLANGCI_LINT_VERSION ?= v2.2.1
64+
GOLANGCI_LINT_VERSION ?= v2.4.0
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.
@@ -266,6 +266,10 @@ $(GOLANGCI_LINT):
266266
| sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
267267
endif
268268

269+
.PHONY: common-print-golangci-lint-version
270+
common-print-golangci-lint-version:
271+
@echo $(GOLANGCI_LINT_VERSION)
272+
269273
.PHONY: precheck
270274
precheck::
271275

README.md

Lines changed: 1 addition & 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`, `17`.
10+
CI Tested PostgreSQL versions: `13`, `14`, `15`, `16`, `17`.
1111

1212
## Quick Start
1313
This package is available for Docker:

VERSION

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

cmd/postgres_exporter/datasource.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"net/url"
1919
"os"
2020
"regexp"
21+
"slices"
2122
"strings"
2223

2324
"github.com/prometheus/client_golang/prometheus"
@@ -64,11 +65,11 @@ func (e *Exporter) discoverDatabaseDSNs() []string {
6465
continue
6566
}
6667
for _, databaseName := range databaseNames {
67-
if contains(e.excludeDatabases, databaseName) {
68+
if slices.Contains(e.excludeDatabases, databaseName) {
6869
continue
6970
}
7071

71-
if len(e.includeDatabases) != 0 && !contains(e.includeDatabases, databaseName) {
72+
if len(e.includeDatabases) != 0 && !slices.Contains(e.includeDatabases, databaseName) {
7273
continue
7374
}
7475

cmd/postgres_exporter/queries.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ var queryOverrides = map[string][]OverrideQuery{
142142
count(*) AS count,
143143
MAX(EXTRACT(EPOCH FROM now() - xact_start))::float AS max_tx_duration
144144
FROM pg_stat_activity
145+
WHERE pid <> pg_backend_pid()
145146
GROUP BY datname,state,usename,application_name,backend_type,wait_event_type,wait_event) AS tmp2
146147
ON tmp.state = tmp2.state AND pg_database.datname = tmp2.datname
147148
`,
@@ -156,7 +157,9 @@ var queryOverrides = map[string][]OverrideQuery{
156157
application_name,
157158
COALESCE(count(*),0) AS count,
158159
COALESCE(MAX(EXTRACT(EPOCH FROM now() - xact_start))::float,0) AS max_tx_duration
159-
FROM pg_stat_activity GROUP BY datname,usename,application_name
160+
FROM pg_stat_activity
161+
WHERE procpid <> pg_backend_pid()
162+
GROUP BY datname,usename,application_name
160163
`,
161164
},
162165
},

cmd/postgres_exporter/util.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,6 @@ import (
2424
"github.com/lib/pq"
2525
)
2626

27-
func contains(a []string, x string) bool {
28-
for _, n := range a {
29-
if x == n {
30-
return true
31-
}
32-
}
33-
return false
34-
}
35-
3627
// convert a string to the corresponding ColumnUsage
3728
func stringToColumnUsage(s string) (ColumnUsage, error) {
3829
var u ColumnUsage

0 commit comments

Comments
 (0)