Skip to content

Commit 7199257

Browse files
tshcherbanSuperQprombotgodbersysadmind
authored
PMM-10820 exporter update (#76)
* Update build * Update to Go 1.18. * Update minimum Go version to 1.17. * Update Go modules for 1.17 format. * Bump Go modules * Enable dependabot. * Update Prometheus common files. * Fixup yamllint. Signed-off-by: SuperQ <[email protected]> * Update common Prometheus files Signed-off-by: prombot <[email protected]> * Update common Prometheus files (prometheus-community#650) Signed-off-by: prombot <[email protected]> * Update common Prometheus files Signed-off-by: prombot <[email protected]> * Update readme to include Postgres 14 support It looks like postgres 14.1 was added to CI here: prometheus-community@fcb2535 See also: prometheus-community#651 (comment) Signed-off-by: Austin Godber <[email protected]> * Bump github.com/prometheus/common from 0.34.0 to 0.35.0 Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.34.0 to 0.35.0. - [Release notes](https://github.com/prometheus/common/releases) - [Commits](prometheus/common@v0.34.0...v0.35.0) --- updated-dependencies: - dependency-name: github.com/prometheus/common dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Release v0.11.0 NOTE: pg_stat_bgwriter counter metrics had the `_total` suffix added prometheus-community#556 * [CHANGE] refactor pg_stat_bgwriter metrics into standalone collector prometheus-community#556 * [FEATURE] Add pg_database collector prometheus-community#613 * [ENHANCEMENT] Add pg_database_size_bytes metric prometheus-community#613 * [BUGFIX] Avoid parsing error from bogus Azure Flexible Server custom GUC prometheus-community#587 * [BUGFIX] Fix pg_stat_archiver error in 9.4 and earlier. prometheus-community#599 * [BUGFIX] Sanitize setting values because of Aurora irregularity prometheus-community#620 Signed-off-by: SuperQ <[email protected]> * fix for exporter issue 633 fix for exporter issue 633: prometheus-community#633 "Scan error on column index 2, name \"checkpoint_write_time\": converting driver.Value type float64 (\"6.594096e+06\") to a int: invalid syntax prometheus-community#633" Signed-off-by: bravosierrasierra <[email protected]> * Fix checkpoint_sync_time value type Error: sql: Scan error on column index 3, name \"checkpoint_sync_time\": converting driver.Value type float64 (\"1.876469e+06\") to a int: invalid syntax See also: prometheus-community#633 prometheus-community#666 Signed-off-by: Nicolas Rodriguez <[email protected]> * Release 0.11.1 * [BUGFIX] Fix checkpoint_write_time value type prometheus-community#666 * [BUGFIX] Fix checkpoint_sync_time value type prometheus-community#667 Signed-off-by: SuperQ <[email protected]> * PMM-10820 missing metric restore * PMM-10820 missing metric drop * PMM-10820 merge fix * PMM-10820 PR review fix Signed-off-by: SuperQ <[email protected]> Signed-off-by: prombot <[email protected]> Signed-off-by: Austin Godber <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: bravosierrasierra <[email protected]> Signed-off-by: Nicolas Rodriguez <[email protected]> Co-authored-by: SuperQ <[email protected]> Co-authored-by: prombot <[email protected]> Co-authored-by: Austin Godber <[email protected]> Co-authored-by: Joe Adams <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: bravosierrasierra <[email protected]> Co-authored-by: Nicolas Rodriguez <[email protected]>
1 parent 80bb494 commit 7199257

File tree

16 files changed

+251
-104
lines changed

16 files changed

+251
-104
lines changed

.circleci/config.yml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
version: 2.1
3+
4+
orbs:
5+
prometheus: prometheus/[email protected]
6+
7+
executors:
8+
# This must match .promu.yml.
9+
golang:
10+
docker:
11+
- image: cimg/go:1.18
12+
13+
jobs:
14+
test:
15+
executor: golang
16+
17+
steps:
18+
- prometheus/setup_environment
19+
- run: make
20+
- prometheus/store_artifact:
21+
file: postgres_exporter
22+
23+
integration:
24+
docker:
25+
- image: cimg/go:1.18
26+
- image: << parameters.postgres_image >>
27+
environment:
28+
POSTGRES_DB: circle_test
29+
POSTGRES_USER: postgres
30+
POSTGRES_PASSWORD: test
31+
32+
parameters:
33+
postgres_image:
34+
type: string
35+
36+
environment:
37+
DATA_SOURCE_NAME: 'postgresql://postgres:test@localhost:5432/circle_test?sslmode=disable'
38+
GOOPTS: '-v -tags integration'
39+
40+
steps:
41+
- checkout
42+
- setup_remote_docker
43+
- run: docker version
44+
- run: make build
45+
- run: make test
46+
47+
workflows:
48+
version: 2
49+
postgres_exporter:
50+
jobs:
51+
- test:
52+
filters:
53+
tags:
54+
only: /.*/
55+
- integration:
56+
matrix:
57+
parameters:
58+
postgres_image:
59+
- circleci/postgres:10
60+
- circleci/postgres:11
61+
- circleci/postgres:12
62+
- circleci/postgres:13
63+
- cimg/postgres:14.1
64+
- prometheus/build:
65+
name: build
66+
parallelism: 3
67+
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
68+
filters:
69+
tags:
70+
ignore: /^v.*/
71+
branches:
72+
ignore: /^(main|master|release-.*|.*build-all.*)$/
73+
- prometheus/build:
74+
name: build_all
75+
parallelism: 12
76+
filters:
77+
branches:
78+
only: /^(main|master|release-.*|.*build-all.*)$/
79+
tags:
80+
only: /^v.*/
81+
- prometheus/publish_master:
82+
context: org-context
83+
docker_hub_organization: prometheuscommunity
84+
quay_io_organization: prometheuscommunity
85+
requires:
86+
- test
87+
- build_all
88+
filters:
89+
branches:
90+
only: master
91+
- prometheus/publish_release:
92+
context: org-context
93+
docker_hub_organization: prometheuscommunity
94+
quay_io_organization: prometheuscommunity
95+
requires:
96+
- test
97+
- build_all
98+
filters:
99+
tags:
100+
only: /^v.*/
101+
branches:
102+
ignore: /.*/

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"

.github/workflows/golangci-lint.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
paths:
5+
- "go.sum"
6+
- "go.mod"
7+
- "**.go"
8+
- "scripts/errcheck_excludes.txt"
9+
- ".github/workflows/golangci-lint.yml"
10+
- ".golangci.yml"
11+
pull_request:
12+
13+
jobs:
14+
golangci:
15+
name: lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
- name: install Go
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: 1.18.x
24+
- name: Install snmp_exporter/generator dependencies
25+
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
26+
if: github.repository == 'prometheus/snmp_exporter'
27+
- name: Lint
28+
uses: golangci/[email protected]
29+
with:
30+
version: v1.45.2

.promu.yml

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

.yamllint

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
braces:
6+
max-spaces-inside: 1
7+
level: error
8+
brackets:
9+
max-spaces-inside: 1
10+
level: error
11+
commas: disable
12+
comments: disable
13+
comments-indentation: disable
14+
document-start: disable
15+
indentation:
16+
spaces: consistent
17+
indent-sequences: consistent
18+
key-duplicates:
19+
ignore: |
20+
config/testdata/section_key_dup.bad.yml
21+
line-length: disable
22+
truthy:
23+
ignore: |
24+
.github/workflows/codeql-analysis.yml
25+
.github/workflows/funcbench.yml
26+
.github/workflows/fuzzing.yml
27+
.github/workflows/prombench.yml
28+
.github/workflows/golangci-lint.yml

CHANGELOG.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
## master / unreleased
22

3-
* [CHANGE] pg_stat_bgwriter counter metrics had the `_total` suffix added #556
3+
## 0.11.1 / 2022-08-01
4+
5+
* [BUGFIX] Fix checkpoint_write_time value type #666
6+
* [BUGFIX] Fix checkpoint_sync_time value type #667
7+
8+
## 0.11.0 / 2022-07-28
9+
10+
NOTE: pg_stat_bgwriter counter metrics had the `_total` suffix added #556
11+
12+
* [CHANGE] refactor pg_stat_bgwriter metrics into standalone collector #556
13+
* [FEATURE] Add pg_database collector #613
414
* [ENHANCEMENT] Add pg_database_size_bytes metric #613
15+
* [BUGFIX] Avoid parsing error from bogus Azure Flexible Server custom GUC #587
16+
* [BUGFIX] Fix pg_stat_archiver error in 9.4 and earlier. #599
17+
* [BUGFIX] Sanitize setting values because of Aurora irregularity #620
518

619
## 0.10.1 / 2022-01-14
720

CODE_OF_CONDUCT.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
## Prometheus Community Code of Conduct
1+
# Prometheus Community Code of Conduct
22

3-
Prometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
3+
Prometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).

Makefile.common

+12-65
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,6 @@ GO_VERSION ?= $(shell $(GO) version)
3636
GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))
3737
PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.')
3838

39-
GOVENDOR :=
40-
GO111MODULE :=
41-
ifeq (, $(PRE_GO_111))
42-
ifneq (,$(wildcard go.mod))
43-
# Enforce Go modules support just in case the directory is inside GOPATH (and for Travis CI).
44-
GO111MODULE := on
45-
46-
ifneq (,$(wildcard vendor))
47-
# Always use the local vendor/ directory to satisfy the dependencies.
48-
GOOPTS := $(GOOPTS) -mod=vendor
49-
endif
50-
endif
51-
else
52-
ifneq (,$(wildcard go.mod))
53-
ifneq (,$(wildcard vendor))
54-
$(warning This repository requires Go >= 1.11 because of Go modules)
55-
$(warning Some recipes may not work as expected as the current Go runtime is '$(GO_VERSION_NUMBER)')
56-
endif
57-
else
58-
# This repository isn't using Go modules (yet).
59-
GOVENDOR := $(FIRST_GOPATH)/bin/govendor
60-
endif
61-
endif
6239
PROMU := $(FIRST_GOPATH)/bin/promu
6340
pkgs = ./...
6441

@@ -83,7 +60,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
8360

8461
GOLANGCI_LINT :=
8562
GOLANGCI_LINT_OPTS ?=
86-
GOLANGCI_LINT_VERSION ?= v1.42.0
63+
GOLANGCI_LINT_VERSION ?= v1.45.2
8764
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
8865
# windows isn't included here because of the path separator being different.
8966
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
@@ -139,87 +116,63 @@ common-style:
139116
.PHONY: common-deps
140117
common-deps:
141118
@echo ">> getting dependencies"
142-
ifdef GO111MODULE
143-
GO111MODULE=$(GO111MODULE) $(GO) mod download
144-
else
145-
$(GO) get $(GOOPTS) -t ./...
146-
endif
119+
$(GO) mod download
147120

148121
.PHONY: update-go-deps
149122
update-go-deps:
150123
@echo ">> updating Go dependencies"
151124
@for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
152125
$(GO) get -d $$m; \
153126
done
154-
GO111MODULE=$(GO111MODULE) $(GO) mod tidy
155-
ifneq (,$(wildcard vendor))
156-
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
157-
endif
127+
$(GO) mod tidy
158128

159129
.PHONY: common-test-short
160130
common-test-short: $(GOTEST_DIR)
161131
@echo ">> running short tests"
162-
GO111MODULE=$(GO111MODULE) $(GOTEST) -short $(GOOPTS) $(pkgs)
132+
$(GOTEST) -short $(GOOPTS) $(pkgs)
163133

164134
.PHONY: common-test
165135
common-test: $(GOTEST_DIR)
166136
@echo ">> running all tests"
167-
GO111MODULE=$(GO111MODULE) $(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)
137+
$(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)
168138

169139
$(GOTEST_DIR):
170140
@mkdir -p $@
171141

172142
.PHONY: common-format
173143
common-format:
174144
@echo ">> formatting code"
175-
GO111MODULE=$(GO111MODULE) $(GO) fmt $(pkgs)
145+
$(GO) fmt $(pkgs)
176146

177147
.PHONY: common-vet
178148
common-vet:
179149
@echo ">> vetting code"
180-
GO111MODULE=$(GO111MODULE) $(GO) vet $(GOOPTS) $(pkgs)
150+
$(GO) vet $(GOOPTS) $(pkgs)
181151

182152
.PHONY: common-lint
183153
common-lint: $(GOLANGCI_LINT)
184154
ifdef GOLANGCI_LINT
185155
@echo ">> running golangci-lint"
186-
ifdef GO111MODULE
187156
# 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
188157
# Otherwise staticcheck might fail randomly for some reason not yet explained.
189-
GO111MODULE=$(GO111MODULE) $(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
190-
GO111MODULE=$(GO111MODULE) $(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
191-
else
192-
$(GOLANGCI_LINT) run $(pkgs)
193-
endif
158+
$(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
159+
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
194160
endif
195161

196162
# For backward-compatibility.
197163
.PHONY: common-staticcheck
198164
common-staticcheck: lint
199165

200166
.PHONY: common-unused
201-
common-unused: $(GOVENDOR)
202-
ifdef GOVENDOR
203-
@echo ">> running check for unused packages"
204-
@$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages'
205-
else
206-
ifdef GO111MODULE
167+
common-unused:
207168
@echo ">> running check for unused/missing packages in go.mod"
208-
GO111MODULE=$(GO111MODULE) $(GO) mod tidy
209-
ifeq (,$(wildcard vendor))
169+
$(GO) mod tidy
210170
@git diff --exit-code -- go.sum go.mod
211-
else
212-
@echo ">> running check for unused packages in vendor/"
213-
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
214-
@git diff --exit-code -- go.sum go.mod vendor/
215-
endif
216-
endif
217-
endif
218171

219172
.PHONY: common-build
220173
common-build: promu
221174
@echo ">> building binaries"
222-
GO111MODULE=$(GO111MODULE) $(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
175+
$(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
223176

224177
.PHONY: common-tarball
225178
common-tarball: promu
@@ -275,12 +228,6 @@ $(GOLANGCI_LINT):
275228
| sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
276229
endif
277230

278-
ifdef GOVENDOR
279-
.PHONY: $(GOVENDOR)
280-
$(GOVENDOR):
281-
GOOS= GOARCH= $(GO) get -u github.com/kardianos/govendor
282-
endif
283-
284231
.PHONY: precheck
285232
precheck::
286233

README.md

+1-1
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: `9.4`, `9.5`, `9.6`, `10`, `11`, `12`, `13`
10+
CI Tested PostgreSQL versions: `9.4`, `9.5`, `9.6`, `10`, `11`, `12`, `13`, `14`
1111

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

SECURITY.md

+1-1
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/>

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.10.1
1+
0.11.1

0 commit comments

Comments
 (0)