From 3ba593b23838d19a004a5187c1aa6ed52b2faa0a Mon Sep 17 00:00:00 2001 From: tamirms Date: Thu, 27 Jun 2024 14:43:54 +0100 Subject: [PATCH] Fix ingestion duration metric so it includes time reaping lookup tables --- services/horizon/internal/ingest/fsm.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/services/horizon/internal/ingest/fsm.go b/services/horizon/internal/ingest/fsm.go index 283cd3347a..c165faf371 100644 --- a/services/horizon/internal/ingest/fsm.go +++ b/services/horizon/internal/ingest/fsm.go @@ -537,9 +537,6 @@ func (r resumeState) run(s *system) (transition, error) { return retryResume(r), err } - duration = time.Since(startTime).Seconds() - s.Metrics().LedgerIngestionDuration.Observe(float64(duration)) - // Update stats metrics changeStatsMap := stats.changeStats.Map() r.addLedgerStatsMetricFromMap(s, "change", changeStatsMap) @@ -560,6 +557,13 @@ func (r resumeState) run(s *system) (transition, error) { // roll up and be reported here as part of resumeState transition addHistoryArchiveStatsMetrics(s, s.historyAdapter.GetStats()) + s.maybeVerifyState(ingestLedger, ledgerCloseMeta.BucketListHash()) + s.maybeReapHistory(ingestLedger) + s.maybeReapLookupTables(ingestLedger) + + duration = time.Since(startTime).Seconds() + s.Metrics().LedgerIngestionDuration.Observe(float64(duration)) + localLog := log.WithFields(logpkg.F{ "sequence": ingestLedger, "duration": duration, @@ -577,10 +581,6 @@ func (r resumeState) run(s *system) (transition, error) { localLog.Info("Processed ledger") - s.maybeVerifyState(ingestLedger, ledgerCloseMeta.BucketListHash()) - s.maybeReapHistory(ingestLedger) - s.maybeReapLookupTables(ingestLedger) - return resumeImmediately(ingestLedger), nil }