Merge pull request #5497 from filecoin-project/feat/gateway-metrics
export metrics for lotus-gateway
This commit is contained in:
commit
fc6938badb
@ -6,7 +6,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"contrib.go.opencensus.io/exporter/prometheus"
|
||||||
"github.com/filecoin-project/go-jsonrpc"
|
"github.com/filecoin-project/go-jsonrpc"
|
||||||
|
promclient "github.com/prometheus/client_golang/prometheus"
|
||||||
"go.opencensus.io/tag"
|
"go.opencensus.io/tag"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
@ -99,6 +101,17 @@ var runCmd = &cli.Command{
|
|||||||
rpcServer.Register("Filecoin", metrics.MetricedGatewayAPI(NewGatewayAPI(api)))
|
rpcServer.Register("Filecoin", metrics.MetricedGatewayAPI(NewGatewayAPI(api)))
|
||||||
|
|
||||||
mux.Handle("/rpc/v0", rpcServer)
|
mux.Handle("/rpc/v0", rpcServer)
|
||||||
|
|
||||||
|
registry := promclient.DefaultRegisterer.(*promclient.Registry)
|
||||||
|
exporter, err := prometheus.NewExporter(prometheus.Options{
|
||||||
|
Registry: registry,
|
||||||
|
Namespace: "lotus_gw",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
mux.Handle("/debug/metrics", exporter)
|
||||||
|
|
||||||
mux.PathPrefix("/").Handler(http.DefaultServeMux)
|
mux.PathPrefix("/").Handler(http.DefaultServeMux)
|
||||||
|
|
||||||
/*ah := &auth.Handler{
|
/*ah := &auth.Handler{
|
||||||
|
Loading…
Reference in New Issue
Block a user