FuelLabs / fuel-core

Rust full node implementation of the Fuel v2 protocol.
Other
58.17k stars 2.76k forks source link

chore(metrics): unify metrics architecture / clean up usage of metrics #2144

Open rymnc opened 2 weeks ago

rymnc commented 2 weeks ago

At the moment, all metrics definitions live in https://github.com/FuelLabs/fuel-core/tree/master/crates/metrics, and are used in modules differently.

For example, the rocks_db metrics, are updated as-is with no way for the operator to "opt-in" to this metric collection, shown in an example here - https://github.com/FuelLabs/fuel-core/blob/9f96573224056aa5a11233b821d34cb8ae4fad20/crates/fuel-core/src/state/rocks_db.rs#L551-L555

furthermore, out of all the modules that use metrics, only 3 modules make use of the cli argument --metrics to disable/enable metrics collection, which are block_producer, txpool, and p2p. Please note that block_producer has no metrics, but still takes in the metrics flag and does nothing with it, as defined here - https://github.com/FuelLabs/fuel-core/blob/df142c617730ca910ab0042a1f9615e1d7da4a7e/crates/services/producer/src/config.rs#L4-L7

and constructed here - https://github.com/FuelLabs/fuel-core/blob/2caca6145044bef4c92f6c64d8b5731545a4514a/crates/fuel-core/src/service/config.rs#L157-L159

We need to make a decision on a unified interface for the metrics logging, and ensure that each module that exports metrics makes use of the cli arg --metrics strictly.

Voxelot commented 2 weeks ago

related issue https://github.com/FuelLabs/fuel-core/issues/1361

rymnc commented 2 weeks ago

related issue #1361

good catch, didn't go that far back :)