Commit ed8d3ae3 authored by Lars Gierth's avatar Lars Gierth

api: add /metrics endpoint for prometheus

License: MIT
Signed-off-by: default avatarLars Gierth <larsg@systemli.org>
parent 2d6b787c
......@@ -300,6 +300,7 @@ func serveHTTPApi(req cmds.Request) (error, <-chan error) {
defaultMux("/debug/vars"),
defaultMux("/debug/pprof/"),
corehttp.LogOption(),
corehttp.PrometheusOption("/debug/metrics/prometheus"),
}
if len(cfg.Gateway.RootRedirect) > 0 {
......
package corehttp
import (
"net/http"
prom "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/prometheus/client_golang/prometheus"
"github.com/ipfs/go-ipfs/core"
)
func PrometheusOption(path string) ServeOption {
return func(n *core.IpfsNode, mux *http.ServeMux) (*http.ServeMux, error) {
mux.Handle(path, prom.Handler())
return mux, nil
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment