@cryptotaxi247 / netdata-1 / commits / 32d63fe9a

heartbeat: don't log every discrepancy (#14122)

Costa Tsaousis committed Dec 9, 2022 at 18:56 UTC 32d63fe9a6a18c9e757499f0e23a1169b516f9bf
1 file changed +7 -3
libnetdata/clocks/clocks.c
+7 -3
@@ -296,7 +296,9 @@ usec_t heartbeat_next(heartbeat_t *hb, usec_t tick) {
296 if(unlikely(hb->randomness > tick / 2)) {
297 // TODO: The heartbeat tick should be specified at the heartbeat_init() function
298 usec_t tmp = (now_realtime_usec() * clock_realtime_resolution) % (tick / 2);
299 - info("heartbeat randomness of %llu is too big for a tick of %llu - setting it to %llu", hb->randomness, tick, tmp);
299 +
300 + error_limit_static_global_var(erl, 10, 0);
301 + error_limit(&erl, "heartbeat randomness of %llu is too big for a tick of %llu - setting it to %llu", hb->randomness, tick, tmp);
302 hb->randomness = tmp;
303 }
304
@@ -322,11 +324,13 @@ usec_t heartbeat_next(heartbeat_t *hb, usec_t tick) {
324
325 if(unlikely(now < next)) {
326 errno = 0;
325 - error("heartbeat clock: woke up %llu microseconds earlier than expected (can be due to the CLOCK_REALTIME set to the past).", next - now);
327 + error_limit_static_global_var(erl, 10, 0);
328 + error_limit(&erl, "heartbeat clock: woke up %llu microseconds earlier than expected (can be due to the CLOCK_REALTIME set to the past).", next - now);
329 }
330 else if(unlikely(now - next > tick / 2)) {
331 errno = 0;
329 - error("heartbeat clock: woke up %llu microseconds later than expected (can be due to system load or the CLOCK_REALTIME set to the future).", now - next);
332 + error_limit_static_global_var(erl, 10, 0);
333 + error_limit(&erl, "heartbeat clock: woke up %llu microseconds later than expected (can be due to system load or the CLOCK_REALTIME set to the future).", now - next);
334 }
335
336 if(unlikely(!hb->realtime)) {