Skip to content

Go panic related to postgres-exporter #5502

@victor-smg

Description

@victor-smg

Component(s)

prometheus.exporter.postgres

What's wrong?

There was a bug in postgres-exporter with go panic related to new field coming from postgres database, resolved here

A new release was made 0.19.0 last week, I would like to have alloy use the latest version of postgres-exporter

Alloy is using this fork as reference via a dependency replacement.
I think latest change from upstream in order to have change from the latest release 0.19.0
One need to be a contributor to open PR on the fork. But maybe the existence of the fork itself can be challenge, or alloy could just use the community postgres-exporter

Steps to reproduce

Use postgres cloudsql on GCP on version 18
Run alloy with the following config, with localhost pointing toward cloudsql-proxy

  alloy:
    configMap:
      content: |-
    {{- range $k, $v := .Environment.Values.db }}
        prometheus.exporter.postgres "{{ $v.name }}" {
          data_source_names = ["postgresql://prometheusexporter:{{ $v.pw }}@127.0.0.1:{{ $v.port }}/postgres?sslmode=disable"]
        }

        discovery.relabel "{{ $v.name }}" {
          targets = prometheus.exporter.postgres.{{ $v.name }}.targets

          rule {
            target_label = "instance"
            replacement  = "{{ $k }}"
          }
          rule {
            target_label = "job"
            replacement  = "integrations/postgres_exporter"
          }
        }

System information

No response

Software version

No response

Configuration

alloy:
    configMap:
      content: |-
    {{- range $k, $v := .Environment.Values.db }}
        prometheus.exporter.postgres "{{ $v.name }}" {
          data_source_names = ["postgresql://prometheusexporter:{{ $v.pw }}@127.0.0.1:{{ $v.port }}/postgres?sslmode=disable"]
        }

        discovery.relabel "{{ $v.name }}" {
          targets = prometheus.exporter.postgres.{{ $v.name }}.targets

          rule {
            target_label = "instance"
            replacement  = "{{ $k }}"
          }
          rule {
            target_label = "job"
            replacement  = "integrations/postgres_exporter"
          }
        }

Logs

2026-02-11 10:16:05.357infots=2026-02-11T09:16:05.357610656Z level=info msg="Established new database connection" component_path=/ component_id=prometheus.exporter.postgres.incidents fingerprint=127.0.0.1:5435

2026-02-11 10:16:05.379infots=2026-02-11T09:16:05.379488945Z level=info msg="Semantic version changed" component_path=/ component_id=prometheus.exporter.postgres.incidents server=127.0.0.1:5435 from=0.0.0 to=18.1.0

2026-02-11 10:16:05.386errorpanic: Error converting setting "google_dataplex.max_messages" value "-1:100" to float: strconv.ParseFloat: parsing "-1:100": invalid syntax

2026-02-11 10:16:05.386

2026-02-11 10:16:05.386goroutine 901 [running]:

2026-02-11 10:16:05.386github.com/prometheus-community/postgres_exporter/cmd/postgres_exporter.(*pgSetting).metric(0xc001901400, 0xc00266d320)

2026-02-11 10:16:05.386	/go/pkg/mod/github.com/grafana/[email protected]/cmd/postgres_exporter/pg_setting.go:86 +0x306

2026-02-11 10:16:05.386github.com/prometheus-community/postgres_exporter/cmd/postgres_exporter.querySettings(0xc000968000, 0xc000c2f8c0)

2026-02-11 10:16:05.386	/go/pkg/mod/github.com/grafana/[email protected]/cmd/postgres_exporter/pg_setting.go:55 +0x1d8

2026-02-11 10:16:05.386github.com/prometheus-community/postgres_exporter/cmd/postgres_exporter.(*Server).Scrape(0xc000c2f8c0, 0xc000968000, 0xc0?)

2026-02-11 10:16:05.386	/go/pkg/mod/github.com/grafana/[email protected]/cmd/postgres_exporter/server.go:130 +0xc5

2026-02-11 10:16:05.386github.com/prometheus-community/postgres_exporter/cmd/postgres_exporter.(*Exporter).scrapeDSN(0xc000be2e00, 0xc000968000, {0xc0010f5321, 0x5c})

2026-02-11 10:16:05.386	/go/pkg/mod/github.com/grafana/[email protected]/cmd/postgres_exporter/datasource.go:114 +0x135

2026-02-11 10:16:05.386github.com/prometheus-community/postgres_exporter/cmd/postgres_exporter.(*Exporter).scrape(0xc000be2e00, 0xc000968000)

2026-02-11 10:16:05.386	/go/pkg/mod/github.com/grafana/[email protected]/cmd/postgres_exporter/postgres_exporter.go:699 +0x14f

2026-02-11 10:16:05.386github.com/prometheus-community/postgres_exporter/cmd/postgres_exporter.(*Exporter).Collect(0xc000be2e00, 0xc000968000)

2026-02-11 10:16:05.386	/go/pkg/mod/github.com/grafana/[email protected]/cmd/postgres_exporter/postgres_exporter.go:588 +0x25

2026-02-11 10:16:05.386github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()

2026-02-11 10:16:05.386	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:458 +0xe5

2026-02-11 10:16:05.386created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather in goroutine 732

2026-02-11 10:16:05.386	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:548 +0xbf1

Tip

React with 👍 if this issue is important to you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions