Skip to content

Commit 7f0f2f4

Browse files
committed
fix a bug in custom metrics
1 parent c2eb990 commit 7f0f2f4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

playbooks/roles/metrics-exporter/templates/custom_metrics.py.j2

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,15 @@ def rdma_link_flap_check():
316316
if len(lft_issues["failures"]) > 0 or len(lft_issues["link_down"]) > 0:
317317
if len(lft_issues["failures"]) > 0:
318318
for issue in lft_issues["failures"]:
319-
for net_dev in issue.keys():
320-
unhealthy_net_devices.append(net_dev)
319+
unhealthy_dev = issue.split(":")[0]
320+
if unhealthy_dev not in unhealthy_net_devices:
321+
unhealthy_net_devices.append(unhealthy_dev)
322+
321323
if len(lft_issues["link_down"]) > 0:
322324
for issue in lft_issues["link_down"]:
323-
for net_dev in issue.keys():
324-
unhealthy_net_devices.append(net_dev)
325+
unhealthy_dev = issue.split(":")[0]
326+
if unhealthy_dev not in unhealthy_net_devices:
327+
unhealthy_net_devices.append(unhealthy_dev)
325328

326329
# Write RDMA Link Flapping metric file
327330
with open(tmp_tf_path, "w") as tmp_tf:

0 commit comments

Comments
 (0)