misc/metrics: Add protocols label to address-specific metrics (#2982)

Previously, we would only track the metrics like the number of open connections. With this patch, we extend these metrics with a `protocols` label that contains a "protocol stack". A protocol stack is a multi-address with all variable parts removed. For example, `/ip4/127.0.0.1/tcp/1234` turns into `/ip4/tcp`.

Resolves https://github.com/libp2p/rust-libp2p/issues/2758.
This commit is contained in:
John Turpish
2022-11-15 15:45:14 -05:00
committed by GitHub
parent d5ea93dd71
commit 69efe63229
6 changed files with 138 additions and 26 deletions

View File

@ -38,6 +38,7 @@ mod identify;
mod kad;
#[cfg(feature = "ping")]
mod ping;
mod protocol_stack;
#[cfg(feature = "relay")]
mod relay;
mod swarm;