From 11905c52a27a8e00c5b25e24d512fa4355543308 Mon Sep 17 00:00:00 2001 From: Lane Rettig Date: Mon, 16 Oct 2023 12:55:45 -0400 Subject: [PATCH 1/2] Remove confusing clock warning Don't warn about skipping layers right after fresh start --- timesync/clock.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/timesync/clock.go b/timesync/clock.go index af7132116d..728a8b2aac 100644 --- a/timesync/clock.go +++ b/timesync/clock.go @@ -137,10 +137,13 @@ func (t *NodeClock) tick() { d := t.lastTicked.Difference(layer) tickDistance.Observe(float64(-d)) case layer.Difference(t.lastTicked) > 1: - t.log.With().Warning("clock skipped layers", - log.Stringer("layer", layer), - log.Stringer("last_ticked_layer", t.lastTicked), - ) + // don't warn right after fresh startup + if t.lastTicked != 0 { + t.log.With().Warning("clock skipped layers", + log.Stringer("layer", layer), + log.Stringer("last_ticked_layer", t.lastTicked), + ) + } d := layer.Difference(t.lastTicked) tickDistance.Observe(float64(d)) case layer == t.lastTicked: From 1365b04f186202c120b050d0d2f303f8cda5b391 Mon Sep 17 00:00:00 2001 From: Lane Rettig Date: Mon, 16 Oct 2023 15:19:30 -0400 Subject: [PATCH 2/2] Review feedback Combine conditional, drop metrics as well right after startup --- timesync/clock.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/timesync/clock.go b/timesync/clock.go index 728a8b2aac..0685a480fb 100644 --- a/timesync/clock.go +++ b/timesync/clock.go @@ -136,14 +136,12 @@ func (t *NodeClock) tick() { ) d := t.lastTicked.Difference(layer) tickDistance.Observe(float64(-d)) - case layer.Difference(t.lastTicked) > 1: - // don't warn right after fresh startup - if t.lastTicked != 0 { - t.log.With().Warning("clock skipped layers", - log.Stringer("layer", layer), - log.Stringer("last_ticked_layer", t.lastTicked), - ) - } + // don't warn right after fresh startup + case layer.Difference(t.lastTicked) > 1 && t.lastTicked > 0: + t.log.With().Warning("clock skipped layers", + log.Stringer("layer", layer), + log.Stringer("last_ticked_layer", t.lastTicked), + ) d := layer.Difference(t.lastTicked) tickDistance.Observe(float64(d)) case layer == t.lastTicked: