@@ -51,14 +51,13 @@ def get_metrics_text(self) -> str:
5151 metrics = self .get_metrics_influx_format ()
5252 return "\n " .join (f"{ metric } { current_time } " for metric in metrics )
5353
54- async def collect_metrics (self , provider : dict , config : dict ):
54+ async def collect_metrics (self , provider : dict , config : dict , state_data : dict ):
5555 metric_config = MetricConfig (
5656 timeout = self .grafana_config ["metric_request_timeout" ],
5757 max_latency = self .grafana_config ["metric_max_latency" ],
5858 endpoints = None , # Will be set in factory
5959 extra_params = {"tx_data" : provider .get ("data" )},
6060 )
61- state_data = await BlockchainState .get_data (self .blockchain )
6261
6362 metrics = MetricFactory .create_metrics (
6463 blockchain_name = self .blockchain ,
@@ -116,8 +115,11 @@ async def handle(self) -> Tuple[str, str]:
116115 if p ["blockchain" ] == self .blockchain
117116 ]
118117
118+ state_data = await BlockchainState .get_data (self .blockchain )
119+
119120 collection_tasks = [
120- self .collect_metrics (provider , config ) for provider in rpc_providers
121+ self .collect_metrics (provider , config , state_data )
122+ for provider in rpc_providers
121123 ]
122124 await asyncio .gather (* collection_tasks , return_exceptions = True )
123125
0 commit comments