mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
6840afb45e
* add check * make handshake better * fix a lot of things * Update beacon-chain/p2p/handshake.go * Update beacon-chain/p2p/handshake.go * fix things * fix * fix handshake Co-authored-by: terence tsao <terence@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
27 lines
947 B
Go
27 lines
947 B
Go
package p2p
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
)
|
|
|
|
var (
|
|
p2pPeerCount = promauto.NewGaugeVec(prometheus.GaugeOpts{
|
|
Name: "p2p_peer_count",
|
|
Help: "The number of peers in a given state.",
|
|
},
|
|
[]string{"state"})
|
|
repeatPeerConnections = promauto.NewCounter(prometheus.CounterOpts{
|
|
Name: "p2p_repeat_attempts",
|
|
Help: "The number of repeat attempts the connection handler is triggered for a peer.",
|
|
})
|
|
)
|
|
|
|
func (s *Service) updateMetrics() {
|
|
p2pPeerCount.WithLabelValues("Connected").Set(float64(len(s.peers.Connected())))
|
|
p2pPeerCount.WithLabelValues("Disconnected").Set(float64(len(s.peers.Disconnected())))
|
|
p2pPeerCount.WithLabelValues("Connecting").Set(float64(len(s.peers.Connecting())))
|
|
p2pPeerCount.WithLabelValues("Disconnecting").Set(float64(len(s.peers.Disconnecting())))
|
|
p2pPeerCount.WithLabelValues("Bad").Set(float64(len(s.peers.Bad())))
|
|
}
|