forest icon indicating copy to clipboard operation
forest copied to clipboard

Add Prometheus metrics for RPC endpoints

Open LesnyRumcajs opened this issue 2 years ago • 1 comments

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

LesnyRumcajs avatar Nov 29 '23 16:11 LesnyRumcajs

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.

ruseinov avatar Nov 29 '23 20:11 ruseinov

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.

LesnyRumcajs avatar Jul 31 '24 10:07 LesnyRumcajs

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 avatar Aug 01 '24 12:08 lemmih

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.

LesnyRumcajs avatar Aug 01 '24 13:08 LesnyRumcajs