Skip to content

Commit 865b6fb

Browse files
committed
feat: perform db related monitoring only if monitoring is enabled
1 parent da035a7 commit 865b6fb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

parser/worker.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,13 @@ func (w Worker) ExportTxs(txs []*types.Tx) error {
372372
}
373373
}
374374

375-
dbLatestHeight, err := w.db.GetLastBlockHeight()
376-
if err != nil {
377-
return err
375+
if w.cfg.Monitoring.Enabled {
376+
dbLatestHeight, err := w.db.GetLastBlockHeight()
377+
if err != nil {
378+
return err
379+
}
380+
logging.DBLatestHeight.WithLabelValues("db_latest_height").Set(float64(dbLatestHeight))
378381
}
379-
logging.DBLatestHeight.WithLabelValues("db_latest_height").Set(float64(dbLatestHeight))
380382

381383
return nil
382384
}

0 commit comments

Comments
 (0)