Report non-fatal collection errors in the exporter metric. (#1439)

As per prometheus/client_golang#543, pass the Registry for exporter
metrics when setting up the /metrics HTTP handler.

With this, the `promhttp_metric_handler_errors_total` metric will
increment on (possibly non-fatal) collection-time errors, such as
duplicate metrics from text files.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
This commit is contained in:
Matthias Rampke 2019-07-28 10:37:10 +02:00 committed by Ben Kochie
commit b133213c7a
3 changed files with 9 additions and 0 deletions

View file

@ -116,6 +116,7 @@ func (h *handler) innerHandler(filters ...string) (http.Handler, error) {
ErrorLog: log.NewErrorLogger(),
ErrorHandling: promhttp.ContinueOnError,
MaxRequestsInFlight: h.maxRequests,
Registry: h.exporterMetricsRegistry,
},
)
if h.includeExporterMetrics {