mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-29 02:23:44 +02:00
Feature/track processor state (#78)
* Add a Prom metric to consumers & consumer/producers to track the running state. * New script, gets processor state using prometheus * Bump version, add tg-processor-state to package * Update templates
This commit is contained in:
parent
efc364583b
commit
74a14639bd
23 changed files with 384 additions and 336 deletions
24
scripts/tg-processor-state
Executable file
24
scripts/tg-processor-state
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
import tabulate
|
||||
|
||||
url = 'http://localhost:9090/api/v1/query?query=processor_state%7Bprocessor_state%3D%22running%22%7D'
|
||||
|
||||
resp = requests.get(url)
|
||||
|
||||
obj = resp.json()
|
||||
|
||||
tbl = [
|
||||
[
|
||||
m["metric"]["instance"],
|
||||
"running" if int(m["value"][1]) > 0 else "down"
|
||||
]
|
||||
for m in obj["data"]["result"]
|
||||
]
|
||||
|
||||
print(tabulate.tabulate(
|
||||
tbl, tablefmt="pretty", headers=["processor", "state"],
|
||||
stralign="left"
|
||||
))
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue