p2p: split metrics to reduces module dependencies
Context
fix: #4874 (closed)
From the issue:
This metrics (but also the corresponding metric for the received case) seems a bit fragile. The invariant that the counter is always increased when a message is sent could be broken if the API exposes a new function and does not increase the counter. [...] it would be better to have a single place to increment such a counter.
This MR split the P2p_metrics module into 2 different modules.
P2p_metrics will contains only metrics that are directly incremented in the code and then has no more dependencies with octez p2p modules.
P2p_metrics_collectors will contains metrics that are using collector functions. These functions are requesting the stored data in the p2p layer and then have dependencies with some octez p2p modules.
With P2p_metrics split some metrics have no more cyclic dependencies if placed in the module where the measured operation occurs.
Then in this MR these metrics have been moved to the module they are related to.
Manually testing the MR
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR