From 9bb1fe23eac3ce70c1664111ad2a8f2ca9b10054 Mon Sep 17 00:00:00 2001 From: nugaon Date: Wed, 27 Aug 2025 12:47:46 +0200 Subject: [PATCH 1/2] refactor: use defined buckets on init metrics --- pkg/node/metrics.go | 10 ++++++++-- pkg/node/node.go | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pkg/node/metrics.go b/pkg/node/metrics.go index 90005ceec7a..09095c7e191 100644 --- a/pkg/node/metrics.go +++ b/pkg/node/metrics.go @@ -26,14 +26,20 @@ func newMetrics() nodeMetrics { Subsystem: subsystem, Name: "warmup_duration_seconds", Help: "Duration in seconds for node warmup to complete", + // middle range should be more infrequent (because of addressbook) + Buckets: []float64{10, 12, 14, 16, 18, 20, 30, 45, 60, 90, 120, 180, 240, 300, 400, 420, 440, 460, 480, 550, 600}, }, ), FullSyncDuration: prometheus.NewHistogram( prometheus.HistogramOpts{ Namespace: metrics.Namespace, Subsystem: subsystem, - Name: "full_sync_duration_seconds", - Help: "Duration in seconds for node warmup to complete", + Name: "full_sync_duration_minutes", + Help: "Duration in minutes for node full sync to complete", + // middle range should be more frequent + Buckets: []float64{80, 90, 100, 110, + 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, // 2-3 hours range + 190, 200, 210, 220, 230, 240}, }, ), } diff --git a/pkg/node/node.go b/pkg/node/node.go index f3f37b3f054..7c6ee02f63e 100644 --- a/pkg/node/node.go +++ b/pkg/node/node.go @@ -612,7 +612,6 @@ func NewBee( "totalMonitoredEvents", totalCount, "warmupDurationSeconds", warmupDuration) - // Record the warmup duration in the prometheus metric nodeMetrics.WarmupDuration.Observe(warmupDuration) pullSyncStartTime = t } @@ -1167,10 +1166,11 @@ func NewBee( return case <-syncCheckTicker.C: synced := isFullySynced() - logger.Debug("sync status check", "synced", synced, "reserveSize", localStore.ReserveSize(), "threshold", reserveTreshold, "syncRate", pullerService.SyncRate()) + logger.Debug("sync status check", "synced", synced, "reserveSize", localStore.ReserveSize(), "syncRate", pullerService.SyncRate()) if synced { fullSyncTime := pullSyncStartTime.Sub(t) - nodeMetrics.FullSyncDuration.Observe(fullSyncTime.Seconds()) + logger.Info("full sync duration", "duration", fullSyncTime) + nodeMetrics.FullSyncDuration.Observe(fullSyncTime.Minutes()) syncCheckTicker.Stop() return } From 1c0789098c6be6f08f8327980298caf0ce4a30a3 Mon Sep 17 00:00:00 2001 From: nugaon Date: Wed, 27 Aug 2025 15:22:25 +0200 Subject: [PATCH 2/2] refactor: warmup duration spacing more unified --- pkg/node/metrics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/node/metrics.go b/pkg/node/metrics.go index 09095c7e191..7aba13e6162 100644 --- a/pkg/node/metrics.go +++ b/pkg/node/metrics.go @@ -27,7 +27,7 @@ func newMetrics() nodeMetrics { Name: "warmup_duration_seconds", Help: "Duration in seconds for node warmup to complete", // middle range should be more infrequent (because of addressbook) - Buckets: []float64{10, 12, 14, 16, 18, 20, 30, 45, 60, 90, 120, 180, 240, 300, 400, 420, 440, 460, 480, 550, 600}, + Buckets: []float64{10, 20, 25, 30, 35, 40, 45, 50, 60, 70, 90, 120, 180, 240, 300, 350, 380, 400, 420, 440, 460, 480, 550, 600}, }, ), FullSyncDuration: prometheus.NewHistogram(