From 10fa089ce7576e3b835a0f6faa6b207b5443bb3c Mon Sep 17 00:00:00 2001 From: "Pengfei(Andy) Zhang" Date: Wed, 25 Sep 2024 21:08:30 -0400 Subject: [PATCH] feat(middleware): amend batch method name. --- crates/provider/src/traits/metrics.rs | 2 +- crates/rpc/src/rpc_metrics.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/provider/src/traits/metrics.rs b/crates/provider/src/traits/metrics.rs index 26e497117..2408e6653 100644 --- a/crates/provider/src/traits/metrics.rs +++ b/crates/provider/src/traits/metrics.rs @@ -26,7 +26,7 @@ impl RequestExtractor for RPCMethodExtractor { } _ => { // can't extract method name for batch. - "unknown".to_string() + "batch".to_string() } } } diff --git a/crates/rpc/src/rpc_metrics.rs b/crates/rpc/src/rpc_metrics.rs index 61fb95c95..085428818 100644 --- a/crates/rpc/src/rpc_metrics.rs +++ b/crates/rpc/src/rpc_metrics.rs @@ -14,11 +14,11 @@ use jsonrpsee::types::Request; use rundler_types::task::traits::RequestExtractor; -#[derive(Copy)] +#[derive(Copy, Clone)] struct RPCMethodExtractor; -impl RequestExtractor for RPCMethodExtractor { - fn get_method_name(req: &Request) -> String { +impl RequestExtractor> for RPCMethodExtractor { + fn get_method_name(req: & Request<'static>) -> String { req.method_name().to_string() } }