forked from LBRYCommunity/lbry-sdk
metric for time to send notifications
This commit is contained in:
parent
28838c1759
commit
ac1a8b4daf
1 changed files with 6 additions and 0 deletions
|
@ -169,6 +169,10 @@ class SessionManager:
|
||||||
"notifications_in_flight", "Count of notifications in flight",
|
"notifications_in_flight", "Count of notifications in flight",
|
||||||
namespace=NAMESPACE
|
namespace=NAMESPACE
|
||||||
)
|
)
|
||||||
|
notifications_sent_metric = Histogram(
|
||||||
|
"notifications_sent", "Time to send an address notification",
|
||||||
|
namespace=NAMESPACE, buckets=HISTOGRAM_BUCKETS
|
||||||
|
)
|
||||||
|
|
||||||
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):
|
||||||
|
@ -942,7 +946,9 @@ class LBRYElectrumX(SessionBase):
|
||||||
self.session_mgr.notifications_in_flight_metric.inc()
|
self.session_mgr.notifications_in_flight_metric.inc()
|
||||||
status = await self.address_status(hashX)
|
status = await self.address_status(hashX)
|
||||||
self.session_mgr.address_history_metric.observe(time.perf_counter() - start)
|
self.session_mgr.address_history_metric.observe(time.perf_counter() - start)
|
||||||
|
start = time.perf_counter()
|
||||||
await self.send_notification(method, (alias, status))
|
await self.send_notification(method, (alias, status))
|
||||||
|
self.session_mgr.notifications_sent_metric.observe(time.perf_counter() - start)
|
||||||
finally:
|
finally:
|
||||||
self.session_mgr.notifications_in_flight_metric.dec()
|
self.session_mgr.notifications_in_flight_metric.dec()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue