Continue scrape with duplicated metrics
Problems of a single collector, like duplicated metrics read via the textfile collector, should not fail the collection and export of other metrics.
This commit is contained in:
parent
a0a0dbaad0
commit
dace41e3d4
2 changed files with 93 additions and 49 deletions
|
|
@ -158,10 +158,16 @@ func main() {
|
|||
log.Infof(" - %s", n)
|
||||
}
|
||||
|
||||
prometheus.MustRegister(NodeCollector{collectors: collectors})
|
||||
if err := prometheus.Register(NodeCollector{collectors: collectors}); err != nil {
|
||||
log.Fatalf("Couldn't register collector: %s", err)
|
||||
}
|
||||
handler := promhttp.HandlerFor(prometheus.DefaultGatherer,
|
||||
promhttp.HandlerOpts{ErrorLog: log.NewErrorLogger()})
|
||||
promhttp.HandlerOpts{
|
||||
ErrorLog: log.NewErrorLogger(),
|
||||
ErrorHandling: promhttp.ContinueOnError,
|
||||
})
|
||||
|
||||
// TODO(ts): Remove deprecated and problematic InstrumentHandler usage.
|
||||
http.Handle(*metricsPath, prometheus.InstrumentHandler("prometheus", handler))
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(`<html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue