From b10255a6ddfb119399873a63cbe31d08c2c85f82 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Tue, 3 Oct 2023 13:27:32 -0400 Subject: [PATCH] Update cpu and memory event code Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com> --- crates/client/src/telemetry.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/client/src/telemetry.rs b/crates/client/src/telemetry.rs index 8d51a3d1fe..38a4115ddd 100644 --- a/crates/client/src/telemetry.rs +++ b/crates/client/src/telemetry.rs @@ -90,14 +90,12 @@ pub enum ClickhouseEvent { model: &'static str, }, Cpu { - usage_as_percent: f32, + usage_as_percentage: f32, core_count: u32, }, Memory { memory_in_bytes: u64, virtual_memory_in_bytes: u64, - start_time_in_seconds: u64, - run_time_in_seconds: u64, }, } @@ -168,8 +166,6 @@ impl Telemetry { const DURATION_BETWEEN_SYSTEM_EVENTS: Duration = Duration::from_secs(60); smol::Timer::after(DURATION_BETWEEN_SYSTEM_EVENTS).await; - let telemetry_settings = cx.update(|cx| *settings::get::(cx)); - system.refresh_memory(); system.refresh_processes(); @@ -184,15 +180,15 @@ impl Telemetry { let memory_event = ClickhouseEvent::Memory { memory_in_bytes: process.memory(), virtual_memory_in_bytes: process.virtual_memory(), - start_time_in_seconds: process.start_time(), - run_time_in_seconds: process.run_time(), }; let cpu_event = ClickhouseEvent::Cpu { - usage_as_percent: process.cpu_usage(), + usage_as_percentage: process.cpu_usage(), core_count: system.cpus().len() as u32, }; + let telemetry_settings = cx.update(|cx| *settings::get::(cx)); + this.report_clickhouse_event(memory_event, telemetry_settings); this.report_clickhouse_event(cpu_event, telemetry_settings); }