From 6bd43962823aa01908e0e57a482148d29c1f6a0c Mon Sep 17 00:00:00 2001 From: Manuel Schmidt Date: Thu, 17 Oct 2024 09:30:55 +0200 Subject: [PATCH] fix: cope with inboundGovernor metrics missing --- src/blockperf/app.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/blockperf/app.py b/src/blockperf/app.py index 7211714..52572d0 100644 --- a/src/blockperf/app.py +++ b/src/blockperf/app.py @@ -140,12 +140,12 @@ def mqtt_payload_from(self, sample: BlockSample) -> dict: if endpoint := self.app_config.prometheus_endpoint: metrics = self.prometheus_metrics(endpoint) if metrics: - payload["inboundGovernor_hot"] = int( - metrics.get("cardano_node_metrics_inboundGovernor_hot") - ) - payload["inboundGovernor_warm"] = int( - metrics.get("cardano_node_metrics_inboundGovernor_warm") - ) + hot = metrics.get("cardano_node_metrics_inboundGovernor_hot") + if hot: + payload["inboundGovernor_hot"] = int(hot) + warm = metrics.get("cardano_node_metrics_inboundGovernor_warm") + if warm: + payload["inboundGovernor_warm"] = int(warm) return payload def ensure_maxblocks(self):