diff --git a/gateway/core/corehttp/prometheus.go b/gateway/core/corehttp/prometheus.go new file mode 100644 index 000000000..d6e8ef4d0 --- /dev/null +++ b/gateway/core/corehttp/prometheus.go @@ -0,0 +1,16 @@ +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 + } +}