Slow down sampling metric collection rate (#3775)

Joseph T. Lyons created

Release Notes:

- N/A

Change summary

crates/client/src/telemetry.rs  | 7 ++++---
crates/client2/src/telemetry.rs | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)

Detailed changes

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);

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);