albertodonato / query-exporter

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

queries_created HELP is incorrect #180

Closed lchopfpt closed 8 months ago

lchopfpt commented 8 months ago

Describe the bug The "HELP" for the builtin queries_created says that it is "Number of database queries". It is not, it is a timestamp.

Installation details

To Reproduce

curl -s http://localhost:9560/metrics | grep queries_created
# HELP queries_created Number of database queries
# TYPE queries_created gauge
queries_created{database="dbA",query="qA",status="success"} 1.7031844611678915e+09
queries_created{database="dbB",query="qB",status="success"} 1.7031844611735206e+09
queries_created{database="dbC",query="qA",status="success"} 1.7031844611756735e+09
queries_created{database="dbD",query="qB",status="success"} 1.7031844611857781e+09

Please update the HELP, the README, and maybe how one might use these timestamps to monitor query failure

albertodonato commented 8 months ago

The queries metric is a single metric, which tracks number of queries by status.

Since it's a counter, this generates two actual metrics:

# HELP queries_total Number of database queries
# HELP queries_created Number of database queries

The former tracks the count, the latter is just to indicate when the series was created (as a timestamp). The latter can be disabled via environment variable if desired.