mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-12 06:42:11 +02:00
Use auth on metrics API
This commit is contained in:
parent
9c55a0a0ff
commit
b09e785a53
1 changed files with 5 additions and 1 deletions
|
|
@ -178,7 +178,11 @@ def check_processors(url: str, min_processors: int, timeout: int, token: Optiona
|
||||||
url += '/'
|
url += '/'
|
||||||
metrics_url = f"{url}api/metrics/query?query=processor_info"
|
metrics_url = f"{url}api/metrics/query?query=processor_info"
|
||||||
|
|
||||||
resp = requests.get(metrics_url, timeout=timeout)
|
headers = {}
|
||||||
|
if token:
|
||||||
|
headers["Authorization"] = f"Bearer {token}"
|
||||||
|
|
||||||
|
resp = requests.get(metrics_url, timeout=timeout, headers=headers)
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
data = resp.json()
|
data = resp.json()
|
||||||
processor_count = len(data.get("data", {}).get("result", []))
|
processor_count = len(data.get("data", {}).get("result", []))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue