From fffdaded0f7951a38dea957a63c9c962fd5215f8 Mon Sep 17 00:00:00 2001 From: Oskars Date: Mon, 18 Sep 2023 22:30:21 +0300 Subject: [PATCH] Log SQL error message (#344) Co-authored-by: Oskars Pakers --- collector/collector.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/collector.go b/collector/collector.go index 187facf5..d2e4c056 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -312,7 +312,7 @@ func (e *Exporter) scrape(ch chan<- prometheus.Metric) { scrapeStart := time.Now() if err = e.ScrapeMetric(e.db, ch, metric); err != nil { - level.Error(e.logger).Log("Error scraping for", metric.Context, "_", metric.MetricsDesc, time.Since(scrapeStart), ":", err) + level.Error(e.logger).Log("Error scraping for", metric.Context, "_", metric.MetricsDesc, time.Since(scrapeStart), ":", err.Error()) e.scrapeErrors.WithLabelValues(metric.Context).Inc() } else { level.Debug(e.logger).Log("Successfully scraped metric: ", metric.Context, metric.MetricsDesc, time.Since(scrapeStart))