Skip to content

Commit

Permalink
chore: log stats structure alongside totals
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap committed Oct 16, 2023
1 parent c0b85a0 commit efbcf06
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/background/db_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,20 @@ 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
}
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)
Expand Down

0 comments on commit efbcf06

Please sign in to comment.