Skip to content

Commit

Permalink
Fixed race condition for err variable
Browse files Browse the repository at this point in the history
  • Loading branch information
valrusu committed Jul 2, 2024
1 parent d9c0e1f commit bc7fde2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func (e *Exporter) scrape(ch chan<- prometheus.Metric) {
err = err1
}
errmutex.Unlock()
level.Error(e.logger).Log("scrapeMetricContext", metric.Context, "ScrapeDuration", time.Since(scrapeStart), "msg", err.Error())
level.Error(e.logger).Log("scrapeMetricContext", metric.Context, "ScrapeDuration", time.Since(scrapeStart), "msg", err1.Error())
e.scrapeErrors.WithLabelValues(metric.Context).Inc()
} else {
level.Debug(e.logger).Log("successfully scraped metric: ", metric.Context, metric.MetricsDesc, time.Since(scrapeStart))
Expand Down

0 comments on commit bc7fde2

Please sign in to comment.