|
|
@ -123,22 +123,34 @@ func (h *handler) innerHandler(filters ...string) (http.Handler, error) { |
|
|
|
if err := r.Register(nc); err != nil { |
|
|
|
if err := r.Register(nc); err != nil { |
|
|
|
return nil, fmt.Errorf("couldn't register node collector: %s", err) |
|
|
|
return nil, fmt.Errorf("couldn't register node collector: %s", err) |
|
|
|
} |
|
|
|
} |
|
|
|
handler := promhttp.HandlerFor( |
|
|
|
|
|
|
|
prometheus.Gatherers{h.exporterMetricsRegistry, r}, |
|
|
|
var handler http.Handler |
|
|
|
promhttp.HandlerOpts{ |
|
|
|
|
|
|
|
ErrorLog: stdlog.New(log.NewStdlibAdapter(level.Error(h.logger)), "", 0), |
|
|
|
|
|
|
|
ErrorHandling: promhttp.ContinueOnError, |
|
|
|
|
|
|
|
MaxRequestsInFlight: h.maxRequests, |
|
|
|
|
|
|
|
Registry: h.exporterMetricsRegistry, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
if h.includeExporterMetrics { |
|
|
|
if h.includeExporterMetrics { |
|
|
|
|
|
|
|
handler = promhttp.HandlerFor( |
|
|
|
|
|
|
|
prometheus.Gatherers{h.exporterMetricsRegistry, r}, |
|
|
|
|
|
|
|
promhttp.HandlerOpts{ |
|
|
|
|
|
|
|
ErrorLog: stdlog.New(log.NewStdlibAdapter(level.Error(h.logger)), "", 0), |
|
|
|
|
|
|
|
ErrorHandling: promhttp.ContinueOnError, |
|
|
|
|
|
|
|
MaxRequestsInFlight: h.maxRequests, |
|
|
|
|
|
|
|
Registry: h.exporterMetricsRegistry, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) |
|
|
|
// Note that we have to use h.exporterMetricsRegistry here to
|
|
|
|
// Note that we have to use h.exporterMetricsRegistry here to
|
|
|
|
// use the same promhttp metrics for all expositions.
|
|
|
|
// use the same promhttp metrics for all expositions.
|
|
|
|
handler = promhttp.InstrumentMetricHandler( |
|
|
|
handler = promhttp.InstrumentMetricHandler( |
|
|
|
h.exporterMetricsRegistry, handler, |
|
|
|
h.exporterMetricsRegistry, handler, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
handler = promhttp.HandlerFor( |
|
|
|
|
|
|
|
r, |
|
|
|
|
|
|
|
promhttp.HandlerOpts{ |
|
|
|
|
|
|
|
ErrorLog: stdlog.New(log.NewStdlibAdapter(level.Error(h.logger)), "", 0), |
|
|
|
|
|
|
|
ErrorHandling: promhttp.ContinueOnError, |
|
|
|
|
|
|
|
MaxRequestsInFlight: h.maxRequests, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return handler, nil |
|
|
|
return handler, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|