Skip to content

Commit 7f0e17f

Browse files
committed
state data moved out of collect metrics
1 parent ca94d13 commit 7f0e17f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

common/metrics_handler.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)