-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
metrics: add transport label to p2p_peers_total #2728
Conversation
for _, conn := range c.Node.PeerHost.Network().Conns() { | ||
tr := "" | ||
for _, proto := range conn.RemoteMultiaddr().Protocols() { | ||
tr = tr + "/" + proto.Name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this would be good to have in go-multiaddr, Multiaddr.ProtocolsString()
Hold on, I'll also add a version label, so that we can also graph peer counts by remote-version. |
Mh does anything store the remote version? The peerstore maybe? I don't wanna fire any requests, just read existing data. |
Ok let's go ahead with this one, without remote-version.
|
func (c IpfsNodeCollector) PeersTotalValue() float64 { | ||
return float64(len(c.Node.PeerHost.Network().Conns())) | ||
func (c IpfsNodeCollector) PeersTotalValues() map[string]float64 { | ||
vals := map[string]float64{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i prefer using make
for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it make
I think we store the remote version in the peerstore, although we can add that in later. |
aside from one nitpick, this LGTM |
Gives us per-transport peers counts: ipfs_p2p_peers_total{transport="/ip4/tcp"} 25 ipfs_p2p_peers_total{transport="/ip6/tcp"} 13 ipfs_p2p_peers_total{transport="/ip6/udp/utp"} 17 License: MIT Signed-off-by: Lars Gierth <larsg@systemli.org>
91e141f
to
05cb7a1
Compare
Gives us per-transport peers counts:
License: MIT
Signed-off-by: Lars Gierth larsg@systemli.org