OffchainLabs / go-ethereum

GNU Lesser General Public License v3.0
52 stars 88 forks source link

Collect all the Meter fields for prometheus #299

Closed Tristan-Wilson closed 3 months ago

Tristan-Wilson commented 3 months ago

The RateX() fields were not being collected.

Testing done

Prior to the change, the only metric is compact_time for the prometheus endpoint:

$ curl -s localhost:6070/debug/metrics/prometheus | grep 'compact_time'
# TYPE compact_time gauge
compact_time 0
$ curl -s localhost:6070/debug/metrics | grep 'compact/time'
"compact/time.count": 0,
"compact/time.fifteen-minute": 0,
"compact/time.five-minute": 0,
"compact/time.mean": 0,
"compact/time.one-minute": 0,

After the change, there is a compact_time metric shown with labels for each of the rates and there is also a compact_time_count metric which just has the count.

$ curl -s localhost:6070/debug/metrics/prometheus | grep 'compact_time'
# TYPE compact_time_count counter
compact_time_count 0
# TYPE compact_time summary
compact_time {rate="1m"} 0
compact_time {rate="5m"} 0
compact_time {rate="15m"} 0
compact_time {rate="mean"} 0
$ curl -s localhost:6070/debug/metrics | grep 'compact/time'
"compact/time.count": 0,
"compact/time.fifteen-minute": 0,
"compact/time.five-minute": 0,
"compact/time.mean": 0,
"compact/time.one-minute": 0,

This would add an extra 740 metrics to the prometheus endpoint for Nitro which uses go-ethereum, on top of the existing 687.

$ curl -s localhost:6070/debug/metrics/prometheus | grep -ve '^#\|^$' | grep -v 'rate=' | wc
    687    1675   26097
ubuntu@ip-172-31-11-180 ~/sepolia/data/3/blobs 0
Mon Apr 01 12:25:17
$ curl -s localhost:6070/debug/metrics/prometheus | grep 'rate=' | wc
    740    2220   33869
Tristan-Wilson commented 3 months ago

We're discussing if we want to increase the metrics count by so much; I'll fix the tests if we decide to go ahead with it.

Tristan-Wilson commented 3 months ago

We think this will increase the number of metrics too much, we'll just use the prometheus rate feature to post-aggregate instead.