update popularity_contest script to match new status page

This commit is contained in:
Bryan Stitt 2023-06-05 15:50:44 -07:00
parent f66edd961b
commit 640bcd1378

View File

@ -24,8 +24,9 @@ struct BackendRpcData<'a> {
// block_data_limit: u64, // block_data_limit: u64,
head_block: u64, head_block: u64,
requests: u64, requests: u64,
head_latency: f64, head_latency_ms: f64,
request_latency: f64, peak_latency_ms: f64,
peak_ewma_ms: f64,
} }
impl PopularityContestSubCommand { impl PopularityContestSubCommand {
@ -83,14 +84,21 @@ impl PopularityContestSubCommand {
highest_block = highest_block.max(head_block); 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 let peak_latency_ms = conn
.get("request_latency") .get("peak_latency_ms")
.unwrap_or(&serde_json::Value::Null) .unwrap_or(&serde_json::Value::Null)
.as_f64() .as_f64()
.unwrap_or_default(); .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 { let rpc_data = BackendRpcData {
name, name,
// tier, // tier,
@ -98,8 +106,9 @@ impl PopularityContestSubCommand {
// block_data_limit, // block_data_limit,
requests, requests,
head_block, head_block,
head_latency, head_latency_ms,
request_latency, peak_latency_ms,
peak_ewma_ms,
}; };
total_requests += rpc_data.requests; total_requests += rpc_data.requests;
@ -152,8 +161,8 @@ impl PopularityContestSubCommand {
tier_request_pct, tier_request_pct,
total_request_pct, total_request_pct,
highest_block - rpc.head_block, highest_block - rpc.head_block,
format!("{:.3}", rpc.head_latency), format!("{:.3}", rpc.head_latency_ms),
format!("{:.3}", rpc.request_latency), format!("{:.3}", rpc.peak_latency_ms),
]); ]);
} }
} }