Skip to content

Commit

Permalink
Update metrics collector, remove jobs key
Browse files Browse the repository at this point in the history
  • Loading branch information
catileptic committed Mar 18, 2024
1 parent 91e00e0 commit 40a393c
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions aleph/metrics/collectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,22 @@ def collect(self):
stages = {}

for collection_status in status["datasets"].values():
for job_status in collection_status["jobs"]:
for stage_status in job_status["stages"]:
stage = stage_status["stage"]
pending = stage_status["pending"]
running = stage_status["running"]

if stage not in stages:
stages[stage] = {
"pending": 0,
"running": 0,
}
for stage_status in collection_status["stages"]:
stage = stage_status["stage"]
pending = stage_status["pending"]
running = stage_status["running"]

if stage not in stages:
stages[stage] = {
"pending": stages[stage].get("pending") + pending,
"running": stages[stage].get("running") + running,
"pending": 0,
"running": 0,
}

stages[stage] = {
"pending": stages[stage].get("pending") + pending,
"running": stages[stage].get("running") + running,
}

tasks_gauge = GaugeMetricFamily(
"aleph_tasks",
"Total number of pending or running tasks in a given stage",
Expand Down

0 comments on commit 40a393c

Please sign in to comment.