forked from LBRYCommunity/lbry-sdk
add reorg count metric to prometheus
This commit is contained in:
parent
64f7f837e7
commit
f7065c6f0c
2 changed files with 5 additions and 2 deletions
|
@ -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.hash import hash_to_hex_str, HASHX_LEN
|
||||||
from lbry.wallet.server.util import chunks, class_logger
|
from lbry.wallet.server.util import chunks, class_logger
|
||||||
from lbry.wallet.server.leveldb import FlushData
|
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:
|
class Prefetcher:
|
||||||
|
@ -255,6 +255,7 @@ class BlockProcessor:
|
||||||
last -= len(raw_blocks)
|
last -= len(raw_blocks)
|
||||||
self.db.sql.delete_claims_above_height(self.height)
|
self.db.sql.delete_claims_above_height(self.height)
|
||||||
await self.prefetcher.reset_height(self.height)
|
await self.prefetcher.reset_height(self.height)
|
||||||
|
REORG_COUNT.inc()
|
||||||
|
|
||||||
async def reorg_hashes(self, count):
|
async def reorg_hashes(self, count):
|
||||||
"""Return a pair (start, last, hashes) of blocks to back up during a
|
"""Return a pair (start, last, hashes) of blocks to back up during a
|
||||||
|
|
|
@ -51,7 +51,9 @@ BLOCK_COUNT = Gauge(
|
||||||
"block_count", "Number of processed blocks", namespace=NAMESPACE
|
"block_count", "Number of processed blocks", namespace=NAMESPACE
|
||||||
)
|
)
|
||||||
BLOCK_UPDATE_TIMES = Histogram("block_time", "Block update times", 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:
|
class PrometheusServer:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
Loading…
Reference in a new issue