fix(observability): refresh metric timestamps on each loop iteration
Move clock initialization inside processing loops to ensure exported metrics reflect the current time rather than a stale timestamp.
This commit is contained in:
3 files changed
+6
-8
No files matched your search
@@ -26,12 +26,12 @@ impl ReflectorSelector {
|
||||
let mut reselection_count = 0;
|
||||
let baseline_sleep_time =
|
||||
Duration::from_secs_f64(self.config.tick_interval * std::f64::consts::PI);
|
||||
let clock = Time::new(ClockId::Realtime);
|
||||
|
||||
// Initial wait of several seconds to allow some OWD data to build up
|
||||
sleep(baseline_sleep_time);
|
||||
|
||||
loop {
|
||||
// Capture current time at the start of each iteration for metric timestamps
|
||||
let clock = Time::new(ClockId::Realtime);
|
||||
/*
|
||||
* Selection is triggered either by some other thread triggering it through the channel,
|
||||
* or it passes the timeout. In any case we don't care about the result of this function,
|
||||
|
||||
Reference in new issue
Block a user