network/metrics: Expose number of banned peers from peerstore and enable litep2p metrics (#4977)
This PR extends the metrics exposed by the peerstore with the total number of banned peers. The new metric is exposed under `substrate_sub_libp2p_peerset_num_banned_peers`. To easily extend metrics in the future, the `fn num_known_peers` is removed in favor of `fn status`. While at it, enable the metrics for litep2p: - total number of peers from peerstore (needed to debug memory consumption) - total number of banned peers from peerstore (needed to debug reputation bans and disconnects) Have added a couple of tests to validate that the number of banned peers is exposed properly. Part of: https://github.com/paritytech/polkadot-sdk/issues/4681 ### Testing Done Using [subp2p-explorer](https://github.com/lexnv/subp2p-explorer) have submitted random data on tx protocol. The peer gets banned, the num of banned peers is incremented then the peer is disconnected. cc @paritytech/networking --------- Signed-off-by:Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by:
Dmitry Markin <dmitry@markin.tech>
parent
9974a68c
Showing
- cumulus/client/relay-chain-minimal-node/src/lib.rs 4 additions, 2 deletionscumulus/client/relay-chain-minimal-node/src/lib.rs
- cumulus/polkadot-parachain/src/service.rs 4 additions, 1 deletioncumulus/polkadot-parachain/src/service.rs
- cumulus/test/service/src/lib.rs 5 additions, 3 deletionscumulus/test/service/src/lib.rs
- polkadot/node/service/src/lib.rs 4 additions, 2 deletionspolkadot/node/service/src/lib.rs
- substrate/bin/node/cli/src/service.rs 4 additions, 2 deletionssubstrate/bin/node/cli/src/service.rs
- substrate/client/network/src/config.rs 6 additions, 2 deletionssubstrate/client/network/src/config.rs
- substrate/client/network/src/litep2p/mod.rs 5 additions, 2 deletionssubstrate/client/network/src/litep2p/mod.rs
- substrate/client/network/src/litep2p/peerstore.rs 77 additions, 27 deletionssubstrate/client/network/src/litep2p/peerstore.rs
- substrate/client/network/src/litep2p/shim/notification/tests/fuzz.rs 1 addition, 1 deletion...lient/network/src/litep2p/shim/notification/tests/fuzz.rs
- substrate/client/network/src/mock.rs 0 additions, 4 deletionssubstrate/client/network/src/mock.rs
- substrate/client/network/src/peer_store.rs 66 additions, 16 deletionssubstrate/client/network/src/peer_store.rs
- substrate/client/network/src/protocol/notifications/tests.rs 9 additions, 5 deletionssubstrate/client/network/src/protocol/notifications/tests.rs
- substrate/client/network/src/protocol_controller.rs 0 additions, 1 deletionsubstrate/client/network/src/protocol_controller.rs
- substrate/client/network/src/service.rs 7 additions, 6 deletionssubstrate/client/network/src/service.rs
- substrate/client/network/src/service/metrics.rs 28 additions, 5 deletionssubstrate/client/network/src/service/metrics.rs
- substrate/client/network/src/service/traits.rs 1 addition, 1 deletionsubstrate/client/network/src/service/traits.rs
- substrate/client/network/test/src/fuzz.rs 1 addition, 1 deletionsubstrate/client/network/test/src/fuzz.rs
- substrate/client/network/test/src/lib.rs 2 additions, 1 deletionsubstrate/client/network/test/src/lib.rs
- substrate/client/network/test/src/service.rs 2 additions, 1 deletionsubstrate/client/network/test/src/service.rs
- templates/minimal/node/src/service.rs 4 additions, 1 deletiontemplates/minimal/node/src/service.rs
Please register or sign in to comment