Skip to content

Commit

Permalink
Merge pull request #5497 from filecoin-project/feat/gateway-metrics
Browse files Browse the repository at this point in the history
export metrics for lotus-gateway
  • Loading branch information
magik6k authored Feb 1, 2021
2 parents b7555fd + ed6ccef commit fc6938b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/lotus-gateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import (
"net/http"
"os"

"contrib.go.opencensus.io/exporter/prometheus"
"github.com/filecoin-project/go-jsonrpc"
promclient "github.com/prometheus/client_golang/prometheus"
"go.opencensus.io/tag"

"github.com/filecoin-project/lotus/build"
Expand Down Expand Up @@ -99,6 +101,17 @@ var runCmd = &cli.Command{
rpcServer.Register("Filecoin", metrics.MetricedGatewayAPI(NewGatewayAPI(api)))

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)

/*ah := &auth.Handler{
Expand Down

0 comments on commit fc6938b

Please sign in to comment.