albertodonato / query-exporter

Export Prometheus metrics from SQL queries
GNU General Public License v3.0
436 stars 101 forks source link

Invalid config at queries #175

Closed kuntsali closed 10 months ago

kuntsali commented 10 months ago

Describe the bug

Not sure if this a bug, but. I'm trying to configure metric for replication slot status. But I'm getting error during runtime: Invalid config at queries/pg_replication_slots_active: Additional properties are not allowed ('database' was unexpected)

Installation details

Config

metrics:
    pg_replication_slots_active:
      labels: [slot_name, database_name]
      type: gauge
      description: Replication slot status
      expiration: 60s

queries:
    pg_replication_slots_active:
      database: db
      metrics: [pg_replication_slots_active]
      interval: 30s
      sql: |
        SELECT active::int as pg_replication_slots_active, slot_name, database AS database_name FROM pg_replication_slots;

Obviously that there is a problem with config, but I can't figure out it on my own 😞 Thanks in advance.

albertodonato commented 10 months ago

In the query definition, it should be databases: [db] instead of database:

kuntsali commented 10 months ago

Oh, thanks a lot!