Skip to content

Commit

Permalink
Fix ingestion duration metric so it includes time reaping lookup tables
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms committed Jun 27, 2024
1 parent 8e716d8 commit 3ba593b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions services/horizon/internal/ingest/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand All @@ -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
}

Expand Down

0 comments on commit 3ba593b

Please sign in to comment.