From 18f61cd6a1e1e8846e357dd04b344caf17780e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zapletal?= Date: Mon, 16 Oct 2023 10:34:13 +0200 Subject: [PATCH] chore: log stats structure alongside totals --- internal/background/db_stats.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/background/db_stats.go b/internal/background/db_stats.go index 1e792fd4..8e0ae37f 100644 --- a/internal/background/db_stats.go +++ b/internal/background/db_stats.go @@ -51,7 +51,7 @@ func dbStatsTick(ctx context.Context) error { return fmt.Errorf("stats error: %w", err) } - success, failure := 0, 0 + success, failure, pending := 0, 0, 0 for _, s := range stats.Usage24h { if s.Result == "success" { success += 1 @@ -59,9 +59,12 @@ func dbStatsTick(ctx context.Context) error { if s.Result == "failure" { failure += 1 } + if s.Result == "pending" { + pending += 1 + } metrics.SetReservations24hCount(s.Result, s.Provider, s.Count) } - logger.Debug().Msgf("Reservation statistics for last 24 hours: success=%d, failure=%d", success, failure) + logger.Debug().Interface("stats", stats).Msgf("Reservation totals for last 24 hours: success=%d, failure=%d, pending=%d", success, failure, pending) for _, s := range stats.Usage28d { metrics.SetReservations28dCount(s.Result, s.Provider, s.Count)