serve metrics under /metrics

This commit is contained in:
Anton Kaliaev 2018-06-13 22:40:55 +04:00
parent 5c869b5888
commit 3cdf3b670d
No known key found for this signature in database
GPG Key ID: 7B6881D965918214
3 changed files with 8 additions and 3 deletions

7
Gopkg.lock generated
View File

@ -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

View File

@ -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) {

View File

@ -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 {