sigp / lighthouse

Ethereum consensus client in Rust
https://lighthouse.sigmaprime.io/
Apache License 2.0
2.93k stars 745 forks source link

Replace prometheus client with the official one #2956

Open ackintosh opened 2 years ago

ackintosh commented 2 years ago

Description

Prometheus team have released an official Prometheus instrumentation library for Rust.

https://github.com/prometheus/client_rust

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

ackintosh commented 2 years ago

In lighthouse, the client is used to:

  1. provide metrics endpoint for Prometheus HTTP server, in OpenMetrics specification.
    • beacon_node/http_metrics crate
    • validator_client/http_metrics crate
  2. send BeaconNode/Validator metrics to custom endpoint (e.g. beaconcha.in), in "JSON".
    • monitoring_api crate

The metrics is defined as Ethereum consensus client metrics and Beacon chain metrics.

mxinden commented 2 years ago

: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.

ackintosh commented 2 years ago

đź“ť 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.

ackintosh commented 2 years ago

đź“ť 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.

mxinden commented 2 years ago

I find HistogramTimer a need feature of the prometheus crate. I think it is worth proposing it to the prometheus-client crate @ackintosh.