justwatchcom / sql_exporter

Flexible SQL Exporter for Prometheus.
MIT License
393 stars 108 forks source link

Log warning if column not found in query result #52

Closed mateiw closed 2 years ago

mateiw commented 2 years ago

Log a warning message if the column name from values: is not found in the query result. This can happen for instance when the values: uses mixed case names and the db is PostgreSQL which converts the column names of the result to lower case unless they're quoted with ".

Example: select count(*) as myCount from table returns column name mycount in the result. If values: contains myCount the value of sql_myCount will be 0 without any indication of what the actual problem is. The workaround is to use quotes, i.e. select count(*) as "myCount" ....

dewey commented 2 years ago

Thanks @mateiw!