Skip to content

Commit 0e4506e

Browse files
authored
Merge pull request #746 from prometheus-community/bjk/exporter-toolkit-bump
Update exporter-toolkit
2 parents d4af942 + b1e72a9 commit 0e4506e

File tree

7 files changed

+301
-41
lines changed

7 files changed

+301
-41
lines changed

Diff for: .circleci/config.yml

+2-2
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.18
11+
- image: cimg/go:1.19
1212

1313
jobs:
1414
test:
@@ -22,7 +22,7 @@ jobs:
2222

2323
integration:
2424
docker:
25-
- image: cimg/go:1.18
25+
- image: cimg/go:1.19
2626
- image: << parameters.postgres_image >>
2727
environment:
2828
POSTGRES_DB: circle_test

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

Diff for: README.md

-3
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,6 @@ The following environment variables configure the exporter:
152152
* `DATA_SOURCE_PASS_FILE`
153153
The same as above but reads the password from a file.
154154

155-
* `PG_EXPORTER_WEB_LISTEN_ADDRESS`
156-
Address to listen on for web interface and telemetry. Default is `:9187`.
157-
158155
* `PG_EXPORTER_WEB_TELEMETRY_PATH`
159156
Path under which to expose metrics. Default is `/metrics`.
160157

Diff for: cmd/postgres_exporter/main.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"github.com/prometheus/common/promlog/flag"
2828
"github.com/prometheus/common/version"
2929
"github.com/prometheus/exporter-toolkit/web"
30-
webflag "github.com/prometheus/exporter-toolkit/web/kingpinflag"
30+
"github.com/prometheus/exporter-toolkit/web/kingpinflag"
3131
"gopkg.in/alecthomas/kingpin.v2"
3232
)
3333

@@ -37,8 +37,7 @@ var (
3737
}
3838

3939
configFile = kingpin.Flag("config.file", "Postgres exporter configuration file.").Default("postgres_exporter.yml").String()
40-
listenAddress = kingpin.Flag("web.listen-address", "Address to listen on for web interface and telemetry.").Default(":9187").Envar("PG_EXPORTER_WEB_LISTEN_ADDRESS").String()
41-
webConfig = webflag.AddFlags(kingpin.CommandLine)
40+
webConfig = kingpinflag.AddFlags(kingpin.CommandLine, ":9187")
4241
metricPath = kingpin.Flag("web.telemetry-path", "Path under which to expose metrics.").Default("/metrics").Envar("PG_EXPORTER_WEB_TELEMETRY_PATH").String()
4342
disableDefaultMetrics = kingpin.Flag("disable-default-metrics", "Do not include default metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_DEFAULT_METRICS").Bool()
4443
disableSettingsMetrics = kingpin.Flag("disable-settings-metrics", "Do not include pg_settings metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_SETTINGS_METRICS").Bool()
@@ -146,9 +145,8 @@ func main() {
146145

147146
http.HandleFunc("/probe", handleProbe(logger))
148147

149-
level.Info(logger).Log("msg", "Listening on address", "address", *listenAddress)
150-
srv := &http.Server{Addr: *listenAddress}
151-
if err := web.ListenAndServe(srv, *webConfig, logger); err != nil {
148+
srv := &http.Server{}
149+
if err := web.ListenAndServe(srv, webConfig, logger); err != nil {
152150
level.Error(logger).Log("msg", "Error running HTTP server", "err", err)
153151
os.Exit(1)
154152
}

Diff for: cmd/postgres_exporter/postgres_exporter.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,15 @@ var builtinMetricMaps = map[string]intermediateMetricMap{
212212
},
213213
"pg_stat_replication": {
214214
map[string]ColumnMapping{
215-
"procpid": {DISCARD, "Process ID of a WAL sender process", nil, semver.MustParseRange("<9.2.0")},
216-
"pid": {DISCARD, "Process ID of a WAL sender process", nil, semver.MustParseRange(">=9.2.0")},
217-
"usesysid": {DISCARD, "OID of the user logged into this WAL sender process", nil, nil},
218-
"usename": {DISCARD, "Name of the user logged into this WAL sender process", nil, nil},
219-
"application_name": {LABEL, "Name of the application that is connected to this WAL sender", nil, nil},
220-
"client_addr": {LABEL, "IP address of the client connected to this WAL sender. If this field is null, it indicates that the client is connected via a Unix socket on the server machine.", nil, nil},
221-
"client_hostname": {DISCARD, "Host name of the connected client, as reported by a reverse DNS lookup of client_addr. This field will only be non-null for IP connections, and only when log_hostname is enabled.", nil, nil},
222-
"client_port": {DISCARD, "TCP port number that the client is using for communication with this WAL sender, or -1 if a Unix socket is used", nil, nil},
223-
"backend_start": {DISCARD, "with time zone Time when this process was started, i.e., when the client connected to this WAL sender", nil, nil},
215+
"procpid": {DISCARD, "Process ID of a WAL sender process", nil, semver.MustParseRange("<9.2.0")},
216+
"pid": {DISCARD, "Process ID of a WAL sender process", nil, semver.MustParseRange(">=9.2.0")},
217+
"usesysid": {DISCARD, "OID of the user logged into this WAL sender process", nil, nil},
218+
"usename": {DISCARD, "Name of the user logged into this WAL sender process", nil, nil},
219+
"application_name": {LABEL, "Name of the application that is connected to this WAL sender", nil, nil},
220+
"client_addr": {LABEL, "IP address of the client connected to this WAL sender. If this field is null, it indicates that the client is connected via a Unix socket on the server machine.", nil, nil},
221+
"client_hostname": {DISCARD, "Host name of the connected client, as reported by a reverse DNS lookup of client_addr. This field will only be non-null for IP connections, and only when log_hostname is enabled.", nil, nil},
222+
"client_port": {DISCARD, "TCP port number that the client is using for communication with this WAL sender, or -1 if a Unix socket is used", nil, nil},
223+
"backend_start": {DISCARD, "with time zone Time when this process was started, i.e., when the client connected to this WAL sender", nil, nil},
224224
"backend_xmin": {DISCARD, "The current backend's xmin horizon.", nil, nil},
225225
"state": {LABEL, "Current WAL sender state", nil, nil},
226226
"sent_location": {DISCARD, "Last transaction log position sent on this connection", nil, semver.MustParseRange("<10.0.0")},

Diff for: go.mod

+9-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/prometheus/client_golang v1.13.0
1010
github.com/prometheus/client_model v0.2.0
1111
github.com/prometheus/common v0.37.0
12-
github.com/prometheus/exporter-toolkit v0.7.1
12+
github.com/prometheus/exporter-toolkit v0.8.2
1313
gopkg.in/alecthomas/kingpin.v2 v2.2.6
1414
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
1515
gopkg.in/yaml.v2 v2.4.0
@@ -18,23 +18,24 @@ require (
1818

1919
require (
2020
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
21-
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
21+
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
2222
github.com/beorn7/perks v1.0.1 // indirect
2323
github.com/cespare/xxhash/v2 v2.1.2 // indirect
24+
github.com/coreos/go-systemd/v22 v22.4.0 // indirect
2425
github.com/go-logfmt/logfmt v0.5.1 // indirect
2526
github.com/golang/protobuf v1.5.2 // indirect
2627
github.com/jpillora/backoff v1.0.0 // indirect
2728
github.com/kr/pretty v0.2.1 // indirect
2829
github.com/kr/text v0.1.0 // indirect
2930
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
3031
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
31-
github.com/pkg/errors v0.9.1 // indirect
3232
github.com/prometheus/procfs v0.8.0 // indirect
33-
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
34-
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
35-
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
36-
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
33+
golang.org/x/crypto v0.0.0-20221012134737-56aed061732a // indirect
34+
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect
35+
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect
36+
golang.org/x/sync v0.1.0 // indirect
37+
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
3738
golang.org/x/text v0.3.7 // indirect
38-
google.golang.org/appengine v1.6.6 // indirect
39+
google.golang.org/appengine v1.6.7 // indirect
3940
google.golang.org/protobuf v1.28.1 // indirect
4041
)

0 commit comments

Comments
 (0)