-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathdomain.py
More file actions
45 lines (36 loc) · 1.11 KB
/
domain.py
File metadata and controls
45 lines (36 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from __future__ import annotations
from datetime import datetime
from typing import Literal
from ..core import BaseDomain
TimeSeries = dict[str, dict[Literal["values"], list[tuple[float, str]]]]
class Metrics(BaseDomain):
"""Metrics Domain
:param start: Start of period of metrics reported.
:param end: End of period of metrics reported.
:param step: Resolution of results in seconds.
:param time_series: Dict with time series data, using the name of the time series as
key. The metrics timestamps and values are stored in a list of tuples
``[(timestamp, value), ...]``.
"""
start: datetime
end: datetime
step: float
time_series: TimeSeries
__api_properties__ = (
"start",
"end",
"step",
"time_series",
)
__slots__ = __api_properties__
def __init__(
self,
start: str,
end: str,
step: float,
time_series: TimeSeries,
):
self.start = self._parse_datetime(start)
self.end = self._parse_datetime(end)
self.step = step
self.time_series = time_series