metal-stack / helm-charts

Contains metal-stack Helm charts
MIT License
2 stars 10 forks source link

Postgreslet monitoring enhancements #59

Open TLINDEN opened 1 year ago

TLINDEN commented 1 year ago

Add the following new monitoring features to the postgreslet helmchart:

Slow queries global stats

Metric code see https://github.com/metal-stack/helm-charts/pull/56

User table size stats

  query: "SELECT current_database() datname, pgn.nspname schemaname, pgc.relname, CAST(pgc.reltuples AS BIGINT) table_rows, pg_total_relation_size(pgc.oid) disk_usage_table_bytes, pg_indexes_size(pgc.oid) disk_usage_index_bytes, COALESCE(pg_total_relation_size(pgc.reltoastrelid), 0) disk_usage_toast_bytes FROM pg_class pgc JOIN pg_namespace pgn ON pgc.relnamespace = pgn.oid"
  metrics:
    - datname:
        usage: "LABEL"
        description: "Name of the database that this table is in"
    - schemaname:
        usage: "LABEL"
        description: "Name of the schema that this table is in"
    - relname:
        usage: "LABEL"
        description: "Name of the table, index, view, etc."
    - table_rows:
        usage: "GAUGE"
        decription: "Number of rows in the table. This is only an estimate used by the planner. It is updated by VACUUM, ANALYZE, and a few DDL commands such as CREATE INDEX"
    - disk_usage_table_bytes:
        usage: "GAUGE"
        description: "Total disk space used by the specified table, including all indexes and TOAST data"
    - disk_usage_index_bytes:
        usage: "GAUGE"
        description: "Total disk space used by indexes attached to the specified table"
    - disk_usage_toast_bytes:
        usage: "GAUGE"
        description: "Total disk space used by TOAST data attached to the specified table"

Enable the possibility to turn on postgres exporter auto database discovery

The following environment variables need to be added:

PG_EXPORTER_AUTO_DISCOVER_DATABASES
PG_EXPORTER_EXCLUDE_DATABASES
PG_EXPORTER_INCLUDE_DATABASES