sql_exporter icon indicating copy to clipboard operation
sql_exporter copied to clipboard

When query result has rows with identical labels GET to /metric returns 500

Open danielpof opened this issue 10 months ago • 1 comments

When doing a query that results in rows with identical values in the label columns, scrapping /metrics will return 500 with an error saying that it found duplicate values for metric.

This can make it extremely difficult to troubleshoot because there's no error on the logs and the duplication can be sporadic so in time sensitive queries constant monitoring is required to catch the failure and see the actual error by doing a manual GET to /metrics.

Exporter should be improved so that when there's duplicate rows a clear error log message should be emitted, ideally /metrics should still return 200 and just omit the duplicated metric but just having an error in the logs would prove to be a big benefit.

danielpof avatar Feb 12 '25 08:02 danielpof

Indeed, that's not ideal. If someone wants to go ahead and implement that I'll happily merge that.

dewey avatar Feb 12 '25 12:02 dewey