diff --git a/lbry/wallet/server/block_processor.py b/lbry/wallet/server/block_processor.py index bdb3d014d..d6cdd7b74 100644 --- a/lbry/wallet/server/block_processor.py +++ b/lbry/wallet/server/block_processor.py @@ -10,7 +10,7 @@ from lbry.wallet.server.daemon import DaemonError from lbry.wallet.server.hash import hash_to_hex_str, HASHX_LEN from lbry.wallet.server.util import chunks, class_logger from lbry.wallet.server.leveldb import FlushData -from lbry.wallet.server.prometheus import BLOCK_COUNT, BLOCK_UPDATE_TIMES +from lbry.wallet.server.prometheus import BLOCK_COUNT, BLOCK_UPDATE_TIMES, REORG_COUNT class Prefetcher: @@ -255,6 +255,7 @@ class BlockProcessor: last -= len(raw_blocks) self.db.sql.delete_claims_above_height(self.height) await self.prefetcher.reset_height(self.height) + REORG_COUNT.inc() async def reorg_hashes(self, count): """Return a pair (start, last, hashes) of blocks to back up during a diff --git a/lbry/wallet/server/prometheus.py b/lbry/wallet/server/prometheus.py index a2f82f21e..13359980a 100644 --- a/lbry/wallet/server/prometheus.py +++ b/lbry/wallet/server/prometheus.py @@ -51,7 +51,9 @@ BLOCK_COUNT = Gauge( "block_count", "Number of processed blocks", namespace=NAMESPACE ) BLOCK_UPDATE_TIMES = Histogram("block_time", "Block update times", namespace=NAMESPACE) - +REORG_COUNT = Gauge( + "reorg_count", "Number of reorgs", namespace=NAMESPACE +) class PrometheusServer: def __init__(self):