1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-10-26 02:45:48 +08:00
Files
kubo/core/corehttp/prometheus.go
Juan Batiz-Benet 3f1cbe2f43 corehttp: add net.Listener to ServeOption
ServeOptions take the node and muxer, they should get the listener
too as sometimes they need to operate on the listener address.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-08-02 08:16:51 +02:00

18 lines
384 B
Go

package corehttp
import (
"net"
"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, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) {
mux.Handle(path, prom.Handler())
return mux, nil
}
}