Skip to content

PMM-7 pull upstream changes #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 70 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
e3eaa91
Adds 1kB and 2kB units (#915)
Eric-Tyrrell22 Sep 20, 2023
30d7d25
Add error log when probe collector creation fails (#918)
sysadmind Sep 21, 2023
51415a0
Fix test build failures on 32-bit arch again (#919)
dswarbrick Sep 21, 2023
5e24d43
Add 32-bit testing to CI (#920)
SuperQ Sep 21, 2023
69fc35b
Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (#925)
dependabot[bot] Oct 2, 2023
f0f051c
Update common Prometheus files (#926)
prombot Oct 8, 2023
2a5692c
Adjust collector to use separate connection per scrape (#931)
sysadmind Oct 10, 2023
e2892a7
Bump golang.org/x/net from 0.10.0 to 0.17.0 (#936)
dependabot[bot] Oct 16, 2023
68c176b
Release v0.15.0 (#944)
SuperQ Oct 27, 2023
94b0651
Update common Prometheus files (#951)
prombot Nov 15, 2023
f0ea016
Update common Prometheus files (#963)
prombot Nov 23, 2023
ae1375b
pg_replication_slot: add slot type label (#960)
shamil Nov 23, 2023
34f5443
Bump github.com/prometheus/common from 0.44.0 to 0.45.0 (#948)
dependabot[bot] Nov 23, 2023
5ceae7f
Bump github.com/prometheus/client_model (#949)
dependabot[bot] Nov 24, 2023
f5b613a
pg_stat_database: added support for `active_time` counter (#961)
sitole Nov 28, 2023
825cc8a
Bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#988)
dependabot[bot] Dec 21, 2023
9cfa132
Bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0 (#993)
dependabot[bot] Jan 2, 2024
f98834a
use Info level for excluded databases log message (#1003)
keegancsmith Feb 14, 2024
8f39f5b
Add connection limits metrics for pg_roles and pg_database (#997)
jocelynthode Feb 22, 2024
838f09c
Bump github.com/DATA-DOG/go-sqlmock from 1.5.0 to 1.5.2 (#1000)
dependabot[bot] Feb 22, 2024
89087f1
Bump github.com/prometheus/client_golang from 1.18.0 to 1.19.0 (#1011)
dependabot[bot] Mar 6, 2024
b126e62
Bump github.com/prometheus/client_model from 0.5.0 to 0.6.0 (#1010)
dependabot[bot] Mar 6, 2024
5ffc58c
Bump google.golang.org/protobuf from 1.32.0 to 1.33.0 (#1014)
dependabot[bot] Mar 14, 2024
ddd5136
Bump github.com/prometheus/exporter-toolkit from 0.10.0 to 0.11.0 (#992)
dependabot[bot] Mar 14, 2024
cc0fd2e
Bump golang.org/x/net from 0.20.0 to 0.23.0 (#1021)
dependabot[bot] Apr 21, 2024
a4ac0e6
feat: Add safe_wal_size and wal_status to replication_slot (#1027)
MarcWort May 11, 2024
49f66e1
fix: Only query active_time on pg>=14 (#1045)
MarcWort Jun 25, 2024
3c5ef40
Update README.md (#1038)
fhackenberger Jul 6, 2024
98f75c7
stop logging errors on replicas, fixes #547 (#1048)
saz Sep 5, 2024
3be4edc
Update common Prometheus files (#983)
prombot Oct 17, 2024
3743987
Update common Prometheus files (#1076)
prombot Oct 26, 2024
e854076
chore!: adopt log/slog, drop go-kit/log (#1073)
tjhop Oct 26, 2024
071ebb6
Bump github.com/prometheus/client_golang from 1.20.4 to 1.20.5 (#1079)
dependabot[bot] Oct 26, 2024
f9c7457
Bump github.com/prometheus/common from 0.60.0 to 0.60.1 (#1080)
dependabot[bot] Oct 27, 2024
552ff92
Make walreceiver collector useful w/o repmgr (#1086)
bitfehler Nov 6, 2024
c52405a
Update common Prometheus files (#1083)
prombot Nov 6, 2024
340a104
Bump github.com/prometheus/exporter-toolkit from 0.13.0 to 0.13.1 (#1…
dependabot[bot] Nov 6, 2024
0045c4f
Update common Prometheus files (#1087)
prombot Nov 8, 2024
4abdfa5
Update changelog and version for a v0.16.0 release (#1088)
sysadmind Nov 10, 2024
a324fe3
Fix version header in changelog (#1089)
sysadmind Nov 10, 2024
6f36adf
Update pg_long_running_transactions.go (#1092)
jyothikirant-sayukth Dec 22, 2024
5bb1702
Fix to replace dashes with underscore in the metric names (#1103)
aagarwalla-fx Dec 22, 2024
5145620
Bump github.com/prometheus/exporter-toolkit from 0.13.1 to 0.13.2 (#1…
dependabot[bot] Jan 1, 2025
bea2609
Checkpoint related columns in PG 17 have been moved from pg_stat_bgwr…
n-rodriguez Jan 1, 2025
ecb5ec5
Update common Prometheus files (#1090)
prombot Jan 7, 2025
9de4f19
Update common Prometheus files (#1110)
prombot Jan 7, 2025
7d4c278
Add Postgres 17 for CI test (#1105)
khiemdoan Jan 13, 2025
3acc479
Bump github.com/prometheus/common from 0.61.0 to 0.62.0 (#1118)
dependabot[bot] Feb 13, 2025
d85a771
Update common Prometheus files (#1124)
prombot Feb 14, 2025
072864d
pg_stat_statements PG17 (#1114)
NevermindZ4 Feb 15, 2025
9e42fc0
fix: handle pg_replication_slots on pg<13 (#1098)
michael-todorovic Feb 15, 2025
2ee2a8f
feat: add wait/backend to pg_stat_activity (#1106)
fgalind1 Feb 15, 2025
c3885e8
Export last replay age in replication collector (#1085)
bitfehler Feb 15, 2025
99e1b51
Bump github.com/prometheus/exporter-toolkit from 0.13.2 to 0.14.0 (#1…
dependabot[bot] Feb 15, 2025
4c170ed
Fix missing dsn sanitization for logging (#1104)
sysadmind Feb 15, 2025
8bb1a41
Skip pg_stat_checkpointer collector if pg<17 (#1112)
n-rodriguez Feb 20, 2025
51006ab
Prep for v0.17 (#1127)
sysadmind Feb 21, 2025
2869087
Fix: Handle incoming labels with invalid UTF-8 (#1131)
vancwo Feb 26, 2025
1e574cf
Release v0.17.1 (#1132)
SuperQ Feb 26, 2025
457b6fa
Bump github.com/prometheus/client_golang from 1.20.5 to 1.21.0 (#1133)
dependabot[bot] Mar 3, 2025
602302f
Update common Prometheus files (#1137)
prombot Mar 8, 2025
b0e61bf
Bump golang.org/x/net from 0.33.0 to 0.36.0 (#1138)
dependabot[bot] Mar 16, 2025
2ce65c3
Update common Prometheus files (#1140)
prombot Mar 23, 2025
fca2ad8
Update common Prometheus files (#1142)
prombot Mar 30, 2025
9e86f1e
Adds pg_stat_progress_vacuum collector (#1141)
ianbibby Apr 3, 2025
8d5ec4b
Update Go (#1147)
SuperQ Apr 3, 2025
43576ac
Bump github.com/prometheus/client_golang from 1.21.0 to 1.21.1 (#1144)
dependabot[bot] Apr 3, 2025
f8b7139
Bump github.com/prometheus/common from 0.62.0 to 0.63.0 (#1143)
dependabot[bot] Apr 3, 2025
5edc331
Record table only size bytes as well in addition to the total size by…
Sticksman Apr 18, 2025
6526065
Bump golang.org/x/net from 0.36.0 to 0.38.0 (#1152)
dependabot[bot] Apr 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ executors:
# This must match .promu.yml.
golang:
docker:
- image: cimg/go:1.20
- image: cimg/go:1.24

jobs:
test:
executor: golang

steps:
- prometheus/setup_environment
- run: GOHOSTARCH=386 GOARCH=386 make test
- run: make
- prometheus/store_artifact:
file: postgres_exporter

integration:
docker:
- image: cimg/go:1.20
- image: cimg/go:1.24
- image: << parameters.postgres_image >>
environment:
POSTGRES_DB: circle_test
Expand Down Expand Up @@ -56,12 +57,13 @@ workflows:
matrix:
parameters:
postgres_image:
- circleci/postgres:10
- circleci/postgres:11
- circleci/postgres:12
- circleci/postgres:13
- cimg/postgres:14.1
- cimg/postgres:15.1
- cimg/postgres:14.9
- cimg/postgres:15.4
- cimg/postgres:16.0
- cimg/postgres:17.0
- prometheus/build:
name: build
parallelism: 3
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/container_description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: Push README to Docker Hub
on:
push:
paths:
- "README.md"
- "README-containers.md"
- ".github/workflows/container_description.yml"
branches: [ main, master ]

permissions:
contents: read

jobs:
PushDockerHubReadme:
runs-on: ubuntu-latest
name: Push README to Docker Hub
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
steps:
- name: git checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set docker hub repo name
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
- name: Push README to Dockerhub
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
env:
DOCKER_USER: ${{ secrets.DOCKER_HUB_LOGIN }}
DOCKER_PASS: ${{ secrets.DOCKER_HUB_PASSWORD }}
with:
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
provider: dockerhub
short_description: ${{ env.DOCKER_REPO_NAME }}
# Empty string results in README-containers.md being pushed if it
# exists. Otherwise, README.md is pushed.
readme_file: ''

PushQuayIoReadme:
runs-on: ubuntu-latest
name: Push README to quay.io
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
steps:
- name: git checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set quay.io org name
run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV
- name: Set quay.io repo name
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
- name: Push README to quay.io
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
env:
DOCKER_APIKEY: ${{ secrets.QUAY_IO_API_TOKEN }}
with:
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
provider: quay
# Empty string results in README-containers.md being pushed if it
# exists. Otherwise, README.md is pushed.
readme_file: ''
19 changes: 13 additions & 6 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,28 @@ on:
- ".golangci.yml"
pull_request:

permissions: # added using https://github.com/step-security/secure-repo
contents: read

jobs:
golangci:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: install Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Go
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version: 1.20.x
go-version: 1.24.x
- name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
- name: Lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
with:
version: v1.54.2
args: --verbose
version: v2.0.2
53 changes: 33 additions & 20 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
---
version: "2"
linters:
enable:
- misspell
- revive

issues:
exclude-rules:
- path: _test.go
linters:
- errcheck

linters-settings:
errcheck:
exclude-functions:
# Never check for logger errors.
- (github.com/go-kit/log.Logger).Log
revive:
- misspell
- revive
settings:
errcheck:
exclude-functions:
- (github.com/go-kit/log.Logger).Log
revive:
rules:
- name: unused-parameter
severity: warning
disabled: true
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
severity: warning
disabled: true
- linters:
- errcheck
path: _test.go
paths:
- third_party$
- builtin$
- examples$
formatters:
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
3 changes: 1 addition & 2 deletions .promu.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
go:
# This must match .circle/config.yml.
version: 1.20
version: 1.24
repository:
path: github.com/prometheus-community/postgres_exporter
build:
binaries:
- name: postgres_exporter
path: ./cmd/postgres_exporter
flags: -a -tags 'netgo static_build'
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
Expand Down
2 changes: 2 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
extends: default
ignore: |
**/node_modules

rules:
braces:
Expand Down
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,52 @@
## 0.17.1 / 2025-02-26

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

## 0.17.0 / 2025-02-16

## What's Changed
* [ENHANCEMENT] Add Postgres 17 for CI test by @khiemdoan in https://github.com/prometheus-community/postgres_exporter/pull/1105
* [ENHANCEMENT] Add wait/backend to pg_stat_activity by @fgalind1 in https://github.com/prometheus-community/postgres_exporter/pull/1106
* [ENHANCEMENT] Export last replay age in replication collector by @bitfehler in https://github.com/prometheus-community/postgres_exporter/pull/1085
* [BUGFIX] Fix pg_long_running_transactions time by @jyothikirant-sayukth in https://github.com/prometheus-community/postgres_exporter/pull/1092
* [BUGFIX] Fix to replace dashes with underscore in the metric names by @aagarwalla-fx in https://github.com/prometheus-community/postgres_exporter/pull/1103
* [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
* [BUGFIX] Fix pg_stat_statements for PG17 by @NevermindZ4 in https://github.com/prometheus-community/postgres_exporter/pull/1114
* [BUGFIX] Handle pg_replication_slots on pg<13 by @michael-todorovic in https://github.com/prometheus-community/postgres_exporter/pull/1098
* [BUGFIX] Fix missing dsn sanitization for logging by @sysadmind in https://github.com/prometheus-community/postgres_exporter/pull/1104

## New Contributors
* @jyothikirant-sayukth made their first contribution in https://github.com/prometheus-community/postgres_exporter/pull/1092
* @aagarwalla-fx made their first contribution in https://github.com/prometheus-community/postgres_exporter/pull/1103
* @NevermindZ4 made their first contribution in https://github.com/prometheus-community/postgres_exporter/pull/1114
* @michael-todorovic made their first contribution in https://github.com/prometheus-community/postgres_exporter/pull/1098
* @fgalind1 made their first contribution in https://github.com/prometheus-community/postgres_exporter/pull/1106

**Full Changelog**: https://github.com/prometheus-community/postgres_exporter/compare/v0.16.0...v0.17.0

## 0.16.0 / 2024-11-10

BREAKING CHANGES:

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.

* [CHANGE] Replace logging system #1073
* [ENHANCEMENT] Add save_wal_size and wal_status to replication_slot collector #1027
* [ENHANCEMENT] Add roles collector and connection limit metrics to database collector #997
* [ENHANCEMENT] Excluded databases log messgae is now info level #1003
* [ENHANCEMENT] Add active_time to stat_database collector #961
* [ENHANCEMENT] Add slot_type label to replication_slot collector #960
* [BUGFIX] Fix walreceiver collectore when no repmgr #1086
* [BUGFIX] Remove logging errors on replicas #1048
* [BUGFIX] Fix active_time query on postgres>=14 #1045

## 0.15.0 / 2023-10-27

* [ENHANCEMENT] Add 1kB and 2kB units #915
* [BUGFIX] Add error log when probe collector creation fails #918
* [BUGFIX] Fix test build failures on 32-bit arch #919
* [BUGFIX] Adjust collector to use separate connection per scrape #936

## 0.14.0 / 2023-09-11

* [CHANGE] Add `state` label to pg_process_idle_seconds #862
Expand Down
32 changes: 23 additions & 9 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ endif
GOTEST := $(GO) test
GOTEST_DIR :=
ifneq ($(CIRCLE_JOB),)
ifneq ($(shell command -v gotestsum > /dev/null),)
ifneq ($(shell command -v gotestsum 2> /dev/null),)
GOTEST_DIR := test-results
GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml --
endif
endif

PROMU_VERSION ?= 0.15.0
PROMU_VERSION ?= 0.17.0
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz

SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.54.2
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
GOLANGCI_LINT_VERSION ?= v2.0.2
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
# windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386 arm64))
# 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.
ifneq (,$(SKIP_GOLANGCI_LINT))
Expand Down Expand Up @@ -169,16 +169,20 @@ common-vet:
common-lint: $(GOLANGCI_LINT)
ifdef GOLANGCI_LINT
@echo ">> running golangci-lint"
# 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
# Otherwise staticcheck might fail randomly for some reason not yet explained.
$(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
endif

.PHONY: common-lint-fix
common-lint-fix: $(GOLANGCI_LINT)
ifdef GOLANGCI_LINT
@echo ">> running golangci-lint fix"
$(GOLANGCI_LINT) run --fix $(GOLANGCI_LINT_OPTS) $(pkgs)
endif

.PHONY: common-yamllint
common-yamllint:
@echo ">> running yamllint on all YAML files in the repository"
ifeq (, $(shell command -v yamllint > /dev/null))
ifeq (, $(shell command -v yamllint 2> /dev/null))
@echo "yamllint not installed so skipping"
else
yamllint .
Expand All @@ -204,6 +208,10 @@ common-tarball: promu
@echo ">> building release tarball"
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)

.PHONY: common-docker-repo-name
common-docker-repo-name:
@echo "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)"

.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
common-docker: $(BUILD_DOCKER_ARCHS)
$(BUILD_DOCKER_ARCHS): common-docker-%:
Expand Down Expand Up @@ -267,3 +275,9 @@ $(1)_precheck:
exit 1; \
fi
endef

govulncheck: install-govulncheck
govulncheck ./...

install-govulncheck:
command -v govulncheck > /dev/null || go install golang.org/x/vuln/cmd/govulncheck@latest
Loading