From 314d8cb1ad2b61ba1729fbfa59ec3727b4874376 Mon Sep 17 00:00:00 2001 From: Olexander Hofman Date: Thu, 24 Aug 2023 16:44:03 +0200 Subject: [PATCH] feat: MAMORU-813:Collect Daemons statistics added statistics --- crates/mamoru-sui-sniffer/src/lib.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/mamoru-sui-sniffer/src/lib.rs b/crates/mamoru-sui-sniffer/src/lib.rs index cefae7ac17946..5df7f270c703b 100644 --- a/crates/mamoru-sui-sniffer/src/lib.rs +++ b/crates/mamoru-sui-sniffer/src/lib.rs @@ -69,7 +69,7 @@ impl SuiSniffer { let before_ms = Utc::now().timestamp_millis(); - register_events(ctx_builder.data_mut(), seq, events); + register_events(ctx_builder.data_mut(), seq, events.clone()); let after_ms = Utc::now().timestamp_millis(); @@ -80,7 +80,7 @@ impl SuiSniffer { let before_ms = Utc::now().timestamp_millis(); - register_call_traces(ctx_builder.data_mut(), seq, call_traces); + register_call_traces(ctx_builder.data_mut(), seq, call_traces.clone()); let after_ms = Utc::now().timestamp_millis(); @@ -89,6 +89,15 @@ impl SuiSniffer { after_ms - before_ms, ); + // Set statistics + ctx_builder.set_statistics(0, 1, events.len() as u64, call_traces.len() as u64); + + info!( + "sniffer collected {} events and {} call traces.", + events.len(), + call_traces.len(), + ); + let ctx = ctx_builder.build()?; Result::<_, SuiSnifferError>::Ok(ctx)