From b21b5699dbaa18f6483e0d72a62cd4aff3a85c2d Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Sun, 15 Jan 2023 21:13:02 -0800 Subject: [PATCH] print result as json --- web3_proxy/src/bin/web3_proxy_cli/rpc_accounting.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web3_proxy/src/bin/web3_proxy_cli/rpc_accounting.rs b/web3_proxy/src/bin/web3_proxy_cli/rpc_accounting.rs index 9d9e7170..653ecb02 100644 --- a/web3_proxy/src/bin/web3_proxy_cli/rpc_accounting.rs +++ b/web3_proxy/src/bin/web3_proxy_cli/rpc_accounting.rs @@ -12,6 +12,8 @@ use migration::{ }, Condition, }; +use serde::Serialize; +use serde_json::json; /// count requests #[derive(FromArgs, PartialEq, Debug, Eq)] @@ -37,7 +39,7 @@ pub struct RpcAccountingSubCommand { impl RpcAccountingSubCommand { pub async fn main(self, db_conn: &DatabaseConnection) -> anyhow::Result<()> { - #[derive(Debug, FromQueryResult)] + #[derive(Serialize, FromQueryResult)] struct SelectResult { total_frontend_requests: Decimal, // pub total_backend_retries: Decimal, @@ -137,8 +139,9 @@ impl RpcAccountingSubCommand { .context("no query result")?; info!( - "query_response for chain {:?}: {:#?}", - self.chain_id, query_response + "query_response for chain {:?}: {:#}", + self.chain_id, + json!(query_response) ); // let query_seconds: Decimal = query_response