Skip to content

PostgreSQL Exporter dead metrics #1567

@Deezzir

Description

@Deezzir

Steps to reproduce

  1. Deploy the charm.

Expected behaviour

All PostgreSQL alerts evaluate correctly, and the PostgresqlRestarted alert has access to the postmaster start time metrics.

Actual behaviour

Several alerts are dead because the underlying metrics no longer exist natively in the exporter.

  • PostgresqlHighRateDeadlock (missing postgresql_errors_total)
  • PostgresqlSslCompressionActive (missing pg_stat_ssl_compression)
  • PostgresqlRestarted (fails because --collector.postmaster is not enabled in start-exporter.sh).
  • Custom injecting SQL via queries.yaml file to expose the necessary pg_txid_* and pg_bloat_* metrics is required:
    • PostgresqlLowXidConsumption
    • PostgresqlBloatIndexHigh
    • PostgresqlBloatTableHigh
    • PostgresqlInvalidIndex

Versions

Juju CLI: N/A
Juju agent: N/A
Charm revision: N/A
LXD: N/A

Log output

Juju debug log: N/A

Additional context

Proposals for Discussion:

  1. Enable Postmaster Collector: Update start-exporter.sh to include EXPORTER_OPTS="--collector.postmaster" so PostgresqlRestarted works.
  2. Dead Alerts: Remove PostgresqlHighRateDeadlock and PostgresqlSslCompressionActive as they cannot be exported natively anymore.
  3. Custom Queries (queries.yaml):
    • Maybe inject the custom query only for PostgresqlInvalidIndex as it is relatively lightweight.
    • Question for maintainers: Does it make sense to include the heavier custom queries required for PostgresqlLowXidConsumption, PostgresqlBloatIndexHigh(>80%), and PostgresqlBloatTableHigh(>80%)? Given that the exporter is scraped every ~20 seconds, running these heavy bloat/xid queries frequently could negatively impact database performance.

Reference: samber/awesome-prometheus-alerts#289 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expected

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions