From ac1a8b4dafaa168218385ef4d0c4c73b9e7465cc Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Thu, 18 Jun 2020 12:39:19 -0400 Subject: [PATCH] metric for time to send notifications --- lbry/wallet/server/session.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lbry/wallet/server/session.py b/lbry/wallet/server/session.py index d3e9634b1..748060da2 100644 --- a/lbry/wallet/server/session.py +++ b/lbry/wallet/server/session.py @@ -169,6 +169,10 @@ class SessionManager: "notifications_in_flight", "Count of notifications in flight", 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', shutdown_event: asyncio.Event): @@ -942,7 +946,9 @@ class LBRYElectrumX(SessionBase): self.session_mgr.notifications_in_flight_metric.inc() status = await self.address_status(hashX) self.session_mgr.address_history_metric.observe(time.perf_counter() - start) + start = time.perf_counter() await self.send_notification(method, (alias, status)) + self.session_mgr.notifications_sent_metric.observe(time.perf_counter() - start) finally: self.session_mgr.notifications_in_flight_metric.dec()