Prometheus postgres exporter not showing metric with interval time with single quotes

Viewed 551

I inserted the following postgres query in the queries.yaml file with Labels and metric.

pg_long_running_query_details:
  query: "SELECT distinct a.datname as database , a.usename as user , round(extract(epoch from statement_timestamp()) - extract(epoch from a.query_start)) as age FROM pg_stat_activity a JOIN pg_locks l ON l.pid = a.pid WHERE age(statement_timestamp(), query_start) > interval U&'10 minutes' limit 5"
  metrics:
    - database:
        usage: "LABEL"
        description: "Name of the database"
    - user:
        usage: "LABEL"
        description: "Name of the user"
    - age:
        usage: "GAUGE"
        description: "The age in seconds"

I would expect pg_long_running_query_details_age metric flowing through prometheus. Not only there is no metric but no errors in the exporter too. The query works perfectly fine in psql cli.

When I remove the interval time, i can see the metric. So i'm guessing, its something to do with the single quotes.

What did you see instead? Under which circumstances? No metric in the name 'pg_long.*'

Environment

Ubuntu

System information:

Linux 4.15.0-135-generic x86_64

postgres_exporter version:

Postgres Exporter - Wrouesnel v0.5.1.

postgres_exporter flags:

insert list of flags used here

PostgresSQL version:

 PostgreSQL 11.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit

Logs:

No error logs in the exporter.

0 Answers
Related