Skip to content

Commit 50c53f2

Browse files
author
André Costa
committed
Tweak fetching worker state metric
1 parent aa2790b commit 50c53f2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dashboard/generate.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from datetime import datetime
44
import html
55
import os
6+
import re
67
import socket
78
import subprocess
89
import time
@@ -153,9 +154,12 @@ def check_fw_pipeline(self, ipaddr, port):
153154
break
154155
data += chunk
155156
lines = data.decode("utf-8", errors="ignore").strip().splitlines()
156-
if lines:
157-
return int(lines[-1].split()[1][0]) * 5 # will be either 0 or 1
158-
return data
157+
pattern = re.compile(r'"kafka-to-nexus\.(.+?)\.worker_state":\s*"(\d+)"')
158+
for line in lines:
159+
match = pattern.search(line)
160+
if match:
161+
return int(match.group(2))
162+
return 0
159163
except:
160164
self.dprint("connection reset (by peer?)")
161165
return 0

0 commit comments

Comments
 (0)