Skip to content

Commit

Permalink
Add ErrorLog plumbing to promhttp
Browse files Browse the repository at this point in the history
Fix the error logging of the promhttp handler by connecting it to the
promlog setup.

Fixes: #1886

Signed-off-by: Ben Kochie <superq@gmail.com>
  • Loading branch information
SuperQ committed Nov 14, 2020
1 parent f645d49 commit 64cd011
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -5,7 +5,7 @@
* [FEATURE]
* [ENHANCEMENT] Include TCP OutRsts in netstat metrics
* [ENHANCEMENT] Added XFS inode operations to XFS metrics
* [BUGFIX]
* [BUGFIX] Add ErrorLog plumbing to promhttp

## 1.0.1 / 2020-06-15

Expand Down
2 changes: 2 additions & 0 deletions node_exporter.go
Expand Up @@ -15,6 +15,7 @@ package main

import (
"fmt"
stdlog "log"
"net/http"
_ "net/http/pprof"
"os"
Expand Down Expand Up @@ -121,6 +122,7 @@ func (h *handler) innerHandler(filters ...string) (http.Handler, error) {
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,
Expand Down

0 comments on commit 64cd011

Please sign in to comment.