From 903a44d99180d523c3939a349ca8a9e93922003d Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Wed, 29 Jun 2022 11:14:09 -0400 Subject: [PATCH] add mempool time metric for scribe prometheus --- hub/scribe/service.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hub/scribe/service.py b/hub/scribe/service.py index 206e83c..468c871 100644 --- a/hub/scribe/service.py +++ b/hub/scribe/service.py @@ -40,6 +40,9 @@ class BlockchainProcessorService(BlockchainService): block_update_time_metric = Histogram( "block_time", "Block update times", namespace=NAMESPACE, buckets=HISTOGRAM_BUCKETS ) + mempool_update_time_metric = Histogram( + "mempool_time", "Block update times", namespace=NAMESPACE, buckets=HISTOGRAM_BUCKETS + ) reorg_count_metric = Gauge( "reorg_count", "Number of reorgs", namespace=NAMESPACE ) @@ -1676,7 +1679,9 @@ class BlockchainProcessorService(BlockchainService): break if not blocks: try: + start_mempool_time = time.perf_counter() await self.refresh_mempool() + self.mempool_update_time_metric.observe(time.perf_counter() - start_mempool_time) except asyncio.CancelledError: raise except Exception as err: