Replace prometheus client with the official one
Description
Prometheus team have released an official Prometheus instrumentation library for Rust.
https://github.com/prometheus/client_rust
- announcement: https://twitter.com/PrometheusIO/status/1483584441419276293
- background: https://github.com/tikv/rust-prometheus/issues/392#issuecomment-968072946
We're not having any problems with the current client for now, however, I believe we would take benefits from the official one. ref: https://github.com/tikv/rust-prometheus/issues/392
In lighthouse, the client is used to:
- provide metrics endpoint for Prometheus HTTP server, in OpenMetrics specification.
beacon_node/http_metricscratevalidator_client/http_metricscrate
- send BeaconNode/Validator metrics to custom endpoint (e.g. beaconcha.in), in "JSON".
monitoring_apicrate
The metrics is defined as Ethereum consensus client metrics and Beacon chain metrics.
:wave: libp2p and prometheus-client maintainer here.
Another benefit would be dependency consolidation. libp2p uses prometheus-client and in turn the lighthouse network stack uses prometheus-client.
📝 I'm working on https://github.com/prometheus/client_rust/pull/47. This makes the client able to do our the 2. use case I've mentioned here.
📝 I found out that lighthouse is using HistogramTimer, which is timer to measure and record the duration of an event. (e.g. here)
For now, if I understand correctly, the official client doesn’t have a functionality equivalent to HistogramTimer.
I find HistogramTimer a need feature of the prometheus crate. I think it is worth proposing it to the prometheus-client crate @ackintosh.