consensus-shipyard / ipc

🌳 Spawn multi-level trees of customized, scalable, EVM-compatible networks with IPC. L2++ powered by FVM, Wasm, libp2p, IPFS/IPLD, and CometBFT.
https://ipc.space
Apache License 2.0
41 stars 35 forks source link

Record and Export JSON-RPC Request Latency as a Prometheus Metric for ETH facade #1045

Closed karlem closed 3 months ago

karlem commented 3 months ago

This pull request addresses issue #943 by implementing the recording and exporting of JSON-RPC request latency as a Prometheus histogram. This enhancement will provide better insights into the performance of our JSON-RPC endpoints and enable more effective monitoring and alerting.

karlem commented 3 months ago

Tested locally and confirmed the metrics are coming through:

$ curl http://127.0.0.1:9185/metrics

# HELP rpc_method_call_duration_seconds Histogram of RPC method call durations
# TYPE rpc_method_call_duration_seconds histogram
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="0.005"} 2
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="0.01"} 5
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="0.025"} 5
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="0.05"} 5
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="0.1"} 5
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="0.25"} 5
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="0.5"} 5
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="1"} 5
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="2.5"} 5
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="5"} 5
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="10"} 5
rpc_method_call_duration_seconds_bucket{method="eth_chainId",le="+Inf"} 5
rpc_method_call_duration_seconds_sum{method="eth_chainId"} 0.025024915999999998
rpc_method_call_duration_seconds_count{method="eth_chainId"} 5
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="0.005"} 2
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="0.01"} 5
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="0.025"} 5
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="0.05"} 5
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="0.1"} 5
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="0.25"} 5
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="0.5"} 5
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="1"} 5
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="2.5"} 5
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="5"} 5
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="10"} 5
rpc_method_call_duration_seconds_bucket{method="eth_protocolVersion",le="+Inf"} 5
rpc_method_call_duration_seconds_sum{method="eth_protocolVersion"} 0.024849123999999997
rpc_method_call_duration_seconds_count{method="eth_protocolVersion"} 5