From b788fa4f77486d587bf776b8e69263aae3c9a2d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Fona=C5=82?= Date: Fri, 16 Jan 2026 11:51:59 +0100 Subject: [PATCH] Add more stats data to batch log summary --- sqlitestore.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sqlitestore.go b/sqlitestore.go index e78fa2f..8834eaf 100644 --- a/sqlitestore.go +++ b/sqlitestore.go @@ -104,9 +104,14 @@ func (s *SQLiteStore) FollowEvents(ctx context.Context, iterator arkivevents.Bat for batch := range iterator { if batch.Error != nil { return fmt.Errorf("failed to follow events: %w", batch.Error) - } + totalCreates := 0 + totalUpdates := 0 + totalDeletes := 0 + totalExtends := 0 + totalOwnerChanges := 0 + err := func() error { tx, err := s.writePool.BeginTx(ctx, &sql.TxOptions{ @@ -445,7 +450,11 @@ func (s *SQLiteStore) FollowEvents(ctx context.Context, iterator arkivevents.Bat } s.log.Info("block updated", "block", block.Number, "creates", creates, "updates", updates, "deletes", deletes, "extends", extends, "ownerChanges", ownerChanges) - + totalCreates += creates + totalUpdates += updates + totalDeletes += deletes + totalExtends += extends + totalOwnerChanges += ownerChanges } err = st.UpsertLastBlock(ctx, lastBlock) @@ -463,7 +472,7 @@ func (s *SQLiteStore) FollowEvents(ctx context.Context, iterator arkivevents.Bat return fmt.Errorf("failed to commit transaction: %w", err) } - s.log.Info("batch processed", "firstBlock", firstBlock, "lastBlock", lastBlock, "processingTime", time.Since(startTime)) + s.log.Info("batch processed", "firstBlock", firstBlock, "lastBlock", lastBlock, "processingTime", time.Since(startTime).Milliseconds(), "creates", totalCreates, "updates", totalUpdates, "deletes", totalDeletes, "extends", totalExtends, "ownerChanges", totalOwnerChanges) return nil }()