From eb36ee648d9977c89bc1b796b81a2356df5e4356 Mon Sep 17 00:00:00 2001 From: jiacai2050 Date: Sat, 14 Sep 2024 11:32:07 +0800 Subject: [PATCH] chore: record replay cost in log --- src/analytic_engine/src/instance/wal_replayer.rs | 12 +++++++----- src/server/src/http.rs | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/analytic_engine/src/instance/wal_replayer.rs b/src/analytic_engine/src/instance/wal_replayer.rs index ac1c1a8e5b..96fcf4f873 100644 --- a/src/analytic_engine/src/instance/wal_replayer.rs +++ b/src/analytic_engine/src/instance/wal_replayer.rs @@ -22,6 +22,7 @@ use std::{ fmt::Display, ops::Range, sync::Arc, + time::Instant, }; use async_trait::async_trait; @@ -36,6 +37,7 @@ use logger::{debug, error, info, trace, warn}; use prometheus::{exponential_buckets, register_histogram, Histogram}; use snafu::ResultExt; use table_engine::table::TableId; +use time_ext::current_time_millis; use tokio::sync::{Mutex, MutexGuard}; use wal::{ log_batch::LogEntry, @@ -120,15 +122,15 @@ impl<'a> WalReplayer<'a> { /// Replay tables and return the failed tables and the causes. pub async fn replay(&mut self) -> Result { // Build replay action according to mode. + let table_num = self.table_datas.len(); info!( - "Replay wal logs begin, context:{}, tables:{:?}", + "Replay wal logs begin, context:{}, table_num:{table_num}, tables:{:?}", self.context, self.table_datas ); + let begin = Instant::now(); let result = self.replay.run(&self.context, self.table_datas).await; - info!( - "Replay wal logs finish, context:{}, tables:{:?}", - self.context, self.table_datas, - ); + let cost = Instant::now().duration_since(begin); + info!("Replay wal logs finish, table_num:{table_num}, cost:{cost:?}"); result } diff --git a/src/server/src/http.rs b/src/server/src/http.rs index da74ee8472..83dad8785d 100644 --- a/src/server/src/http.rs +++ b/src/server/src/http.rs @@ -255,7 +255,6 @@ impl Service { .or(self.wal_stats()) .or(self.query_push_down()) .or(self.slow_threshold()) - .with(warp::log("http_requests")) .with(warp::log::custom(|info| { let path = info.path(); // Don't record /debug API