From 41ff37d56e9161ed2946b6cfe5d9758edc2ae8be Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Dec 2023 01:27:22 -0500 Subject: [PATCH] Slow down sampling metric collection rate --- crates/client/src/telemetry.rs | 7 ++++--- crates/client2/src/telemetry.rs | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/client/src/telemetry.rs b/crates/client/src/telemetry.rs index a3e7449cf8a4be5a25b4f7eaaa4f3d2379d70d68..6d70de6138ce26028c3ff5576283e19abef8f2e0 100644 --- a/crates/client/src/telemetry.rs +++ b/crates/client/src/telemetry.rs @@ -187,10 +187,11 @@ impl Telemetry { // Avoiding calling `refresh_all()`, just update what we need system.refresh_specifics(refresh_kind); + // Waiting some amount of time before the first query is important to get a reasonable value + // https://docs.rs/sysinfo/0.29.10/sysinfo/trait.ProcessExt.html#tymethod.cpu_usage + const DURATION_BETWEEN_SYSTEM_EVENTS: Duration = Duration::from_secs(4 * 60); + loop { - // Waiting some amount of time before the first query is important to get a reasonable value - // https://docs.rs/sysinfo/0.29.10/sysinfo/trait.ProcessExt.html#tymethod.cpu_usage - const DURATION_BETWEEN_SYSTEM_EVENTS: Duration = Duration::from_secs(60); smol::Timer::after(DURATION_BETWEEN_SYSTEM_EVENTS).await; system.refresh_specifics(refresh_kind); diff --git a/crates/client2/src/telemetry.rs b/crates/client2/src/telemetry.rs index b303e68183d3a263f11ed0759410a43264c7c564..71c4c33491e99bbb8361f5acbbacd0a59881a409 100644 --- a/crates/client2/src/telemetry.rs +++ b/crates/client2/src/telemetry.rs @@ -205,10 +205,11 @@ impl Telemetry { // Avoiding calling `refresh_all()`, just update what we need system.refresh_specifics(refresh_kind); + // Waiting some amount of time before the first query is important to get a reasonable value + // https://docs.rs/sysinfo/0.29.10/sysinfo/trait.ProcessExt.html#tymethod.cpu_usage + const DURATION_BETWEEN_SYSTEM_EVENTS: Duration = Duration::from_secs(4 * 60); + loop { - // Waiting some amount of time before the first query is important to get a reasonable value - // https://docs.rs/sysinfo/0.29.10/sysinfo/trait.ProcessExt.html#tymethod.cpu_usage - const DURATION_BETWEEN_SYSTEM_EVENTS: Duration = Duration::from_secs(60); smol::Timer::after(DURATION_BETWEEN_SYSTEM_EVENTS).await; system.refresh_specifics(refresh_kind);