From 640bcd137894ee29f324c4b76cb909bb88514765 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Mon, 5 Jun 2023 15:50:44 -0700 Subject: [PATCH] update popularity_contest script to match new status page --- .../bin/web3_proxy_cli/popularity_contest.rs | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/web3_proxy/src/bin/web3_proxy_cli/popularity_contest.rs b/web3_proxy/src/bin/web3_proxy_cli/popularity_contest.rs index 8950c788..610afe8a 100644 --- a/web3_proxy/src/bin/web3_proxy_cli/popularity_contest.rs +++ b/web3_proxy/src/bin/web3_proxy_cli/popularity_contest.rs @@ -24,8 +24,9 @@ struct BackendRpcData<'a> { // block_data_limit: u64, head_block: u64, requests: u64, - head_latency: f64, - request_latency: f64, + head_latency_ms: f64, + peak_latency_ms: f64, + peak_ewma_ms: f64, } impl PopularityContestSubCommand { @@ -83,14 +84,21 @@ impl PopularityContestSubCommand { highest_block = highest_block.max(head_block); - let head_latency = conn.get("head_latency").unwrap().as_f64().unwrap(); + let head_latency_ms = conn.get("head_latency_ms").unwrap().as_f64().unwrap(); - let request_latency = conn - .get("request_latency") + let peak_latency_ms = conn + .get("peak_latency_ms") .unwrap_or(&serde_json::Value::Null) .as_f64() .unwrap_or_default(); + let peak_ewma_ms = conn + .get("peak_ewma_s") + .unwrap_or(&serde_json::Value::Null) + .as_f64() + .unwrap_or_default() + * 1000.0; + let rpc_data = BackendRpcData { name, // tier, @@ -98,8 +106,9 @@ impl PopularityContestSubCommand { // block_data_limit, requests, head_block, - head_latency, - request_latency, + head_latency_ms, + peak_latency_ms, + peak_ewma_ms, }; total_requests += rpc_data.requests; @@ -152,8 +161,8 @@ impl PopularityContestSubCommand { tier_request_pct, total_request_pct, highest_block - rpc.head_block, - format!("{:.3}", rpc.head_latency), - format!("{:.3}", rpc.request_latency), + format!("{:.3}", rpc.head_latency_ms), + format!("{:.3}", rpc.peak_latency_ms), ]); } }