IntersectMBO / ouroboros-network

Specifications of network protocols and implementations of components running these protocols which support a family of Ouroboros Consesus protocols; the diffusion layer of the Cardano Node.
https://ouroboros-network.cardano.intersectmbo.org
Apache License 2.0
276 stars 86 forks source link

Introduce PeerSelectionCounters in PeerSelectionState record #4856

Open crocodile-dentist opened 7 months ago

crocodile-dentist commented 7 months ago

A few monitoring activities (eg. jobPromoteColdPeer, etc) performed by the peer selection governor make a call to peerSelectionStateToCounters function whose result is used directly for tracing purposes. The main governor loop is again recalculating all results. PeerSelectionState record could be augmented with PeerSelectionCounters record, so that the results from the monitoring job could be re-used.

coot commented 6 months ago

Instead of augmenting the state with an additional field, I think it's better to just pass PeerSelectionCounters to the actions as an argument. This will be enough to make sure things are not reevaluated, and we don't clutter the state with extra cache-like fields.