postgres_exporter icon indicating copy to clipboard operation
postgres_exporter copied to clipboard

Bug with constantLabels : "not a valid name for metric pg_static"

Open DB-CL opened this issue 1 year ago • 0 comments

What did you do? I'm trying to use postgres_exporter

What did you expect to see? postgres_exporter handling requests

What did you see instead? Under which circumstances? postgres_exporter crashes at first request to /metrics

Environment Debian 9

  • System information:

Linux 3.14.32-xxxx-grs-ipv6-64 x86_64

  • postgres_exporter version:
postgres_exporter, version 0.12.0-rc.0 (branch: HEAD, revision: ce947b190896adee8834d9042944c805db3a90b7)
  build user:       root@f461ec45c280
  build date:       20220829-15:41:50
  go version:       go1.18.5
  platform:         linux/amd64
  • postgres_exporter flags:
--web.listen-address=:39187 --log.level=debug --constantLabels="instance=staging"

no configuration file

  • PostgreSQL version:

9.6

  • Logs:
Oct 10 17:20:05 localhost postgres_exporter[2022]: panic: "\"instance" is not a valid label name for metric "pg_static"
Oct 10 17:20:05 localhost postgres_exporter[2022]: goroutine 28 [running]:
Oct 10 17:20:05 localhost postgres_exporter[2022]: github.com/prometheus/client_golang/prometheus.MustNewConstMetric(...)
Oct 10 17:20:05 localhost postgres_exporter[2022]: /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/value.go:130
Oct 10 17:20:05 localhost postgres_exporter[2022]: main.(*Exporter).checkMapVersions(0x6fa9140ca0c0, 0x6fa9140266e0?, 0x6fa9140c3130)
Oct 10 17:20:05 localhost postgres_exporter[2022]: /app/cmd/postgres_exporter/postgres_exporter.go:689 +0x1418
Oct 10 17:20:05 localhost postgres_exporter[2022]: main.(*Exporter).scrapeDSN(0x6fa9140ca0c0, 0x6fa91405af64?, {0x6fa9140266e0, 0x48})
Oct 10 17:20:05 localhost postgres_exporter[2022]: /app/cmd/postgres_exporter/datasource.go:113 +0x93
Oct 10 17:20:05 localhost postgres_exporter[2022]: main.(*Exporter).scrape(0x6fa9140ca0c0, 0x0?)
Oct 10 17:20:05 localhost postgres_exporter[2022]: /app/cmd/postgres_exporter/postgres_exporter.go:711 +0x235
Oct 10 17:20:05 localhost postgres_exporter[2022]: main.(*Exporter).Collect(0x6fa9140ca0c0, 0x6fa91405af60?)
Oct 10 17:20:05 localhost postgres_exporter[2022]: /app/cmd/postgres_exporter/postgres_exporter.go:600 +0x27
Oct 10 17:20:05 localhost postgres_exporter[2022]: github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
Oct 10 17:20:05 localhost postgres_exporter[2022]: /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:455 +0x11a
Oct 10 17:20:05 localhost postgres_exporter[2022]: created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
Oct 10 17:20:05 localhost postgres_exporter[2022]: /go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:545 +0xbab
Oct 10 17:20:05 localhost systemd[1]: postgres_exporter.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 10 17:20:05 localhost systemd[1]: Unit postgres_exporter.service entered failed state.

** Additional informations**

I'm using the exact same arguments, with the exact same postgres_exporter version on a different host with a postgres 11.4 and it works.

DB-CL avatar Oct 10 '22 15:10 DB-CL