p2p: add inbound and outbound peers metric (#29424)
This commit is contained in:
parent
a83e57666d
commit
dfb3d46098
@ -37,7 +37,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
activePeerGauge metrics.Gauge = metrics.NilGauge{}
|
activePeerGauge metrics.Gauge = metrics.NilGauge{}
|
||||||
|
activeInboundPeerGauge metrics.Gauge = metrics.NilGauge{}
|
||||||
|
activeOutboundPeerGauge metrics.Gauge = metrics.NilGauge{}
|
||||||
|
|
||||||
ingressTrafficMeter = metrics.NewRegisteredMeter("p2p/ingress", nil)
|
ingressTrafficMeter = metrics.NewRegisteredMeter("p2p/ingress", nil)
|
||||||
egressTrafficMeter = metrics.NewRegisteredMeter("p2p/egress", nil)
|
egressTrafficMeter = metrics.NewRegisteredMeter("p2p/egress", nil)
|
||||||
@ -65,6 +67,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
activePeerGauge = metrics.NewRegisteredGauge("p2p/peers", nil)
|
activePeerGauge = metrics.NewRegisteredGauge("p2p/peers", nil)
|
||||||
|
activeInboundPeerGauge = metrics.NewRegisteredGauge("p2p/peers/inbound", nil)
|
||||||
|
activeOutboundPeerGauge = metrics.NewRegisteredGauge("p2p/peers/outbound", nil)
|
||||||
serveMeter = metrics.NewRegisteredMeter("p2p/serves", nil)
|
serveMeter = metrics.NewRegisteredMeter("p2p/serves", nil)
|
||||||
serveSuccessMeter = metrics.NewRegisteredMeter("p2p/serves/success", nil)
|
serveSuccessMeter = metrics.NewRegisteredMeter("p2p/serves/success", nil)
|
||||||
dialMeter = metrics.NewRegisteredMeter("p2p/dials", nil)
|
dialMeter = metrics.NewRegisteredMeter("p2p/dials", nil)
|
||||||
|
@ -771,8 +771,10 @@ running:
|
|||||||
if p.Inbound() {
|
if p.Inbound() {
|
||||||
inboundCount++
|
inboundCount++
|
||||||
serveSuccessMeter.Mark(1)
|
serveSuccessMeter.Mark(1)
|
||||||
|
activeInboundPeerGauge.Inc(1)
|
||||||
} else {
|
} else {
|
||||||
dialSuccessMeter.Mark(1)
|
dialSuccessMeter.Mark(1)
|
||||||
|
activeOutboundPeerGauge.Inc(1)
|
||||||
}
|
}
|
||||||
activePeerGauge.Inc(1)
|
activePeerGauge.Inc(1)
|
||||||
}
|
}
|
||||||
@ -786,6 +788,9 @@ running:
|
|||||||
srv.dialsched.peerRemoved(pd.rw)
|
srv.dialsched.peerRemoved(pd.rw)
|
||||||
if pd.Inbound() {
|
if pd.Inbound() {
|
||||||
inboundCount--
|
inboundCount--
|
||||||
|
activeInboundPeerGauge.Dec(1)
|
||||||
|
} else {
|
||||||
|
activeOutboundPeerGauge.Dec(1)
|
||||||
}
|
}
|
||||||
activePeerGauge.Dec(1)
|
activePeerGauge.Dec(1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user