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

25 lines
818 B
Python
Raw Normal View History

2024-07-07 12:33:15 +00:00
import strawberry
from typing import Optional
from selfprivacy_api.utils.prometheus import PrometheusQueries, PrometheusQueryResult
2024-06-10 01:57:41 +00:00
@strawberry.type
class Monitoring:
2024-06-10 02:27:37 +00:00
@strawberry.field
def disk_usage(
start: Optional[int] = None, end: Optional[int] = None, step: int = 60
) -> PrometheusQueryResult:
return PrometheusQueries.disk_usage(start, end, step)
2024-07-08 15:18:07 +00:00
@strawberry.field
def memory_usage(
start: Optional[int] = None, end: Optional[int] = None, step: int = 60
) -> PrometheusQueryResult:
return PrometheusQueries.memory_usage(start, end, step)
2024-06-10 02:27:37 +00:00
2024-06-10 01:57:41 +00:00
@strawberry.field
def cpu_usage(
start: Optional[int] = None, end: Optional[int] = None, step: int = 60
) -> PrometheusQueryResult:
return PrometheusQueries.cpu_usage(start, end, step)