diff --git a/Gopkg.lock b/Gopkg.lock index 9d1031e9..e45b84d1 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -173,7 +173,10 @@ [[projects]] name = "github.com/prometheus/client_golang" - packages = ["prometheus"] + packages = [ + "prometheus", + "prometheus/promhttp" + ] revision = "c5b7fccd204277076155f10851dad72b76a49317" version = "v0.8.0" @@ -423,6 +426,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "294ac88a5b44228f5ef841b13602d0a8b8fed5fbe9b9b6df77640d636175be16" + inputs-digest = "3bd388e520a08cd0aa14df2d6f5ecb46449d7c36fd80cf52eb775798e6accbaa" solver-name = "gps-cdcl" solver-version = 1 diff --git a/consensus/state.go b/consensus/state.go index de424718..8c07f9ea 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -391,8 +391,8 @@ func (cs *ConsensusState) SetProposalAndBlock(proposal *types.Proposal, block *t // internal functions for managing the state func (cs *ConsensusState) updateHeight(height int64) { - cs.Height = height cs.metrics.Height.Add(float64(height - cs.Height)) + cs.Height = height } func (cs *ConsensusState) updateRoundStep(round int, step cstypes.RoundStepType) { diff --git a/node/node.go b/node/node.go index 0ca6f777..89d21d1a 100644 --- a/node/node.go +++ b/node/node.go @@ -9,6 +9,7 @@ import ( prometheus "github.com/go-kit/kit/metrics/prometheus" stdprometheus "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" abci "github.com/tendermint/abci/types" amino "github.com/tendermint/go-amino" @@ -532,6 +533,7 @@ func (n *Node) startRPC() ([]net.Listener, error) { wm := rpcserver.NewWebsocketManager(rpccore.Routes, coreCodec, rpcserver.EventSubscriber(n.eventBus)) wm.SetLogger(rpcLogger.With("protocol", "websocket")) mux.HandleFunc("/websocket", wm.WebsocketHandler) + mux.Handle("/metrics", promhttp.Handler()) rpcserver.RegisterRPCFuncs(mux, rpccore.Routes, coreCodec, rpcLogger) listener, err := rpcserver.StartHTTPServer(listenAddr, mux, rpcLogger) if err != nil {