2024-07-07 12:33:15 +00:00
|
|
|
import strawberry
|
2024-07-10 09:43:00 +00:00
|
|
|
from typing import Optional
|
2024-07-08 16:02:34 +00:00
|
|
|
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
|
2024-07-10 12:53:56 +00:00
|
|
|
def disk_usage(
|
2024-07-15 14:00:36 +00:00
|
|
|
self,
|
|
|
|
start: Optional[int] = None,
|
|
|
|
end: Optional[int] = None,
|
|
|
|
step: int = 60,
|
2024-07-10 12:53:56 +00:00
|
|
|
) -> PrometheusQueryResult:
|
2024-07-10 09:43:00 +00:00
|
|
|
return PrometheusQueries.disk_usage(start, end, step)
|
2024-07-08 15:18:07 +00:00
|
|
|
|
|
|
|
@strawberry.field
|
2024-07-10 12:53:56 +00:00
|
|
|
def memory_usage(
|
2024-07-15 14:00:36 +00:00
|
|
|
self,
|
|
|
|
start: Optional[int] = None,
|
|
|
|
end: Optional[int] = None,
|
|
|
|
step: int = 60,
|
2024-07-10 12:53:56 +00:00
|
|
|
) -> PrometheusQueryResult:
|
2024-07-10 09:43:00 +00:00
|
|
|
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
|
2024-07-10 12:53:56 +00:00
|
|
|
def cpu_usage(
|
2024-07-15 14:00:36 +00:00
|
|
|
self,
|
|
|
|
start: Optional[int] = None,
|
|
|
|
end: Optional[int] = None,
|
|
|
|
step: int = 60,
|
2024-07-10 12:53:56 +00:00
|
|
|
) -> PrometheusQueryResult:
|
2024-07-10 09:43:00 +00:00
|
|
|
return PrometheusQueries.cpu_usage(start, end, step)
|