forked from LBRYCommunity/lbry-sdk
notifications_in_flight_metric
This commit is contained in:
parent
50ecb0dac9
commit
28838c1759
2 changed files with 12 additions and 4 deletions
|
@ -697,7 +697,7 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
local_height, height
|
local_height, height
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
log.warning(
|
log.debug(
|
||||||
"local history does not contain %s, requested height %i", tx.id, height
|
"local history does not contain %s, requested height %i", tx.id, height
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -165,6 +165,10 @@ class SessionManager:
|
||||||
"address_history", "Time to fetch an address history",
|
"address_history", "Time to fetch an address history",
|
||||||
namespace=NAMESPACE, buckets=HISTOGRAM_BUCKETS
|
namespace=NAMESPACE, buckets=HISTOGRAM_BUCKETS
|
||||||
)
|
)
|
||||||
|
notifications_in_flight_metric = Gauge(
|
||||||
|
"notifications_in_flight", "Count of notifications in flight",
|
||||||
|
namespace=NAMESPACE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, env: 'Env', db: LBRYLevelDB, bp: LBRYBlockProcessor, daemon: 'Daemon', mempool: 'MemPool',
|
def __init__(self, env: 'Env', db: LBRYLevelDB, bp: LBRYBlockProcessor, daemon: 'Daemon', mempool: 'MemPool',
|
||||||
shutdown_event: asyncio.Event):
|
shutdown_event: asyncio.Event):
|
||||||
|
@ -934,9 +938,13 @@ class LBRYElectrumX(SessionBase):
|
||||||
method = 'blockchain.scripthash.subscribe'
|
method = 'blockchain.scripthash.subscribe'
|
||||||
else:
|
else:
|
||||||
method = 'blockchain.address.subscribe'
|
method = 'blockchain.address.subscribe'
|
||||||
status = await self.address_status(hashX)
|
try:
|
||||||
self.session_mgr.address_history_metric.observe(time.perf_counter() - start)
|
self.session_mgr.notifications_in_flight_metric.inc()
|
||||||
await self.send_notification(method, (alias, status))
|
status = await self.address_status(hashX)
|
||||||
|
self.session_mgr.address_history_metric.observe(time.perf_counter() - start)
|
||||||
|
await self.send_notification(method, (alias, status))
|
||||||
|
finally:
|
||||||
|
self.session_mgr.notifications_in_flight_metric.dec()
|
||||||
|
|
||||||
touched = touched.intersection(self.hashX_subs)
|
touched = touched.intersection(self.hashX_subs)
|
||||||
if touched or (height_changed and self.mempool_statuses):
|
if touched or (height_changed and self.mempool_statuses):
|
||||||
|
|
Loading…
Reference in a new issue