mirror of
https://github.com/status-im/status-go.git
synced 2025-01-24 21:49:54 +00:00
6da469140f
Remove Prometheus and other metric types and use metrics package from go-ethereum.
23 lines
494 B
Go
23 lines
494 B
Go
package node
|
|
|
|
import (
|
|
"github.com/ethereum/go-ethereum/metrics"
|
|
"github.com/ethereum/go-ethereum/node"
|
|
)
|
|
|
|
var (
|
|
nodePeersGauge = metrics.NewRegisteredGauge("p2p/Peers", nil)
|
|
nodeMaxPeersGauge = metrics.NewRegisteredGauge("p2p/MaxPeers", nil)
|
|
)
|
|
|
|
func updateNodeMetrics(node *node.Node) {
|
|
server := node.Server()
|
|
if server == nil {
|
|
logger.Error("server not available")
|
|
return
|
|
}
|
|
|
|
nodePeersGauge.Update(int64(server.PeerCount()))
|
|
nodeMaxPeersGauge.Update(int64(server.MaxPeers))
|
|
}
|