mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
Correct output from tg-show-flow-state and tg-show-processor-state (#846)
This commit is contained in:
parent
7521e152b9
commit
95c3b62ef1
2 changed files with 12 additions and 10 deletions
|
|
@ -44,16 +44,18 @@ def show_processors(metrics_url, flow_label):
|
|||
|
||||
obj = resp.json()
|
||||
|
||||
tbl = [
|
||||
[
|
||||
m["metric"]["job"],
|
||||
"\U0001f49a" if int(m["value"][1]) > 0 else "\U0000274c"
|
||||
]
|
||||
for m in obj["data"]["result"]
|
||||
]
|
||||
# consumer_state is one sample per consumer (queue); a processor
|
||||
# with N subscriptions shows up N times. Aggregate to one row per
|
||||
# processor: green only if every consumer is running.
|
||||
by_proc = {}
|
||||
for m in obj["data"]["result"]:
|
||||
name = m["metric"].get("processor", m["metric"]["job"])
|
||||
running = int(m["value"][1]) > 0
|
||||
by_proc[name] = by_proc.get(name, True) and running
|
||||
|
||||
for row in tbl:
|
||||
print(f"- {row[0]:30} {row[1]}")
|
||||
for name in sorted(by_proc):
|
||||
icon = "\U0001f49a" if by_proc[name] else "\U0000274c"
|
||||
print(f"- {name:30} {icon}")
|
||||
|
||||
def main():
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ def dump_status(url):
|
|||
|
||||
tbl = [
|
||||
[
|
||||
m["metric"]["job"],
|
||||
m["metric"].get("processor", m["metric"]["job"]),
|
||||
"\U0001f49a"
|
||||
]
|
||||
for m in obj["data"]["result"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue