From f9fc7dd57bd8e33bb9b083734c8c5f6f548fc26d Mon Sep 17 00:00:00 2001 From: tgmichel Date: Fri, 9 Dec 2022 12:01:51 +0100 Subject: [PATCH 1/2] Trace result in default `jsonrpsee` middleware --- client/rpc-servers/src/middleware.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/rpc-servers/src/middleware.rs b/client/rpc-servers/src/middleware.rs index 0d77442323241..08e190a53692e 100644 --- a/client/rpc-servers/src/middleware.rs +++ b/client/rpc-servers/src/middleware.rs @@ -204,8 +204,9 @@ impl RpcMiddleware { } /// Called once the JSON-RPC request is finished and response is sent to the output buffer. - fn on_response(&self, _result: &str, started_at: std::time::Instant) { + fn on_response(&self, result: &str, started_at: std::time::Instant) { log::trace!(target: "rpc_metrics", "[{}] on_response started_at={:?}", self.transport_label, started_at); + log::trace!(target: "extra_rpc_metrics", "[{}] result={:?}", self.transport_label, result); self.metrics.requests_finished.with_label_values(&[self.transport_label]).inc(); } } From d837a5438fb11393d1c3516b96df15c88489cb12 Mon Sep 17 00:00:00 2001 From: tgmichel Date: Fri, 9 Dec 2022 15:08:13 +0100 Subject: [PATCH 2/2] `rpc_metrics::extra` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- client/rpc-servers/src/middleware.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/rpc-servers/src/middleware.rs b/client/rpc-servers/src/middleware.rs index 08e190a53692e..9e0d422b2350e 100644 --- a/client/rpc-servers/src/middleware.rs +++ b/client/rpc-servers/src/middleware.rs @@ -206,7 +206,7 @@ impl RpcMiddleware { /// Called once the JSON-RPC request is finished and response is sent to the output buffer. fn on_response(&self, result: &str, started_at: std::time::Instant) { log::trace!(target: "rpc_metrics", "[{}] on_response started_at={:?}", self.transport_label, started_at); - log::trace!(target: "extra_rpc_metrics", "[{}] result={:?}", self.transport_label, result); + log::trace!(target: "rpc_metrics::extra", "[{}] result={:?}", self.transport_label, result); self.metrics.requests_finished.with_label_values(&[self.transport_label]).inc(); } }