forest
forest copied to clipboard
Add Prometheus metrics for RPC endpoints
Issue summary
Each RPC endpoint hit should be reflected in Forest metrics.
At the end of the day, we want to have dashboards showing how often is a given RPC method called.
Ideally, all methods would go through a single method that increases the counter on its, e.g., RPC name label.
Other information and links
It looks like axum supports middleware.
Here's an example: https://github.com/tokio-rs/axum/blob/main/examples/consume-body-in-extractor-or-middleware/src/main.rs, there probably is a better one. I'm happy to take this on.
Another metric that should be included in the RPC endpoints monitoring is duration, so that it's easily verifiable how long given endpoints take to process.
Constant space quantiles: https://docs.rs/average/latest/average/struct.Quantile.html Can be used to report how long it took to execute 50% of calls, 80% of calls, 99% of calls, etc.
Constant space quantiles: https://docs.rs/average/latest/average/struct.Quantile.html Can be used to report how long it took to execute 50% of calls, 80% of calls, 99% of calls, etc.
@lemmih not sure if it's needed given, e.g., https://prometheus.io/docs/concepts/metric_types/#summary or some other in-built histogram. Some more investigation is needed in that regard.