Commit 71756cf9 authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

Merge branch 'rebuilderd-prometheus-exporter' into 'master'

rebuilderd prometheus-exporter: use new /dashboard endpoint

See merge request !270
parents d058dc18 dd6ac87c
Pipeline #4594 passed with stage
in 43 seconds
...@@ -4,8 +4,6 @@ import sys ...@@ -4,8 +4,6 @@ import sys
import shutil import shutil
import tempfile import tempfile
from collections import defaultdict
import requests import requests
# The rebuilderd instance # The rebuilderd instance
...@@ -22,28 +20,13 @@ def format_metric(suite, status, total): ...@@ -22,28 +20,13 @@ def format_metric(suite, status, total):
def get_rebuilderd_data(): def get_rebuilderd_data():
req = requests.get(f'{API_URL}/api/v0/pkgs/list') req = requests.get(f'{API_URL}/api/v0/dashboard')
if req.status_code != 200: if req.status_code != 200:
print(f'Failed to obtain rebuilderd data, http status code: {req.status_code}', file=sys.stderr) print(f'Failed to obtain rebuilderd data, http status code: {req.status_code}', file=sys.stderr)
sys.exit(1) sys.exit(1)
data = req.json() data = req.json()
dataset = defaultdict(dict) return data['suites']
for entry in data:
suite = entry['suite']
status = entry['status']
if suite in dataset:
if status in dataset[suite]:
dataset[suite][status] += 1
else:
dataset[suite][status] = 1
else:
dataset[suite] = defaultdict(dict)
dataset[suite][status] = 1
return dataset
def main(directory): def main(directory):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment