selfprivacy-rest-api/selfprivacy_api/graphql/queries/monitoring.py

34 lines
911 B
Python

import strawberry
from typing import Optional
from selfprivacy_api.utils.prometheus import PrometheusQueries, PrometheusQueryResult
@strawberry.type
class Monitoring:
@strawberry.field
def disk_usage(
self,
start: Optional[int] = None,
end: Optional[int] = None,
step: int = 60,
) -> PrometheusQueryResult:
return PrometheusQueries.disk_usage(start, end, step)
@strawberry.field
def memory_usage(
self,
start: Optional[int] = None,
end: Optional[int] = None,
step: int = 60,
) -> PrometheusQueryResult:
return PrometheusQueries.memory_usage(start, end, step)
@strawberry.field
def cpu_usage(
self,
start: Optional[int] = None,
end: Optional[int] = None,
step: int = 60,
) -> PrometheusQueryResult:
return PrometheusQueries.cpu_usage(start, end, step)