8000 Relax type constraints Timestamp · Cameron-Calpin/client_python@557d123 · GitHub
[go: up one dir, main page]

Skip to content

Commit 557d123

Browse files
committed
Relax type constraints Timestamp
Timestamps in samples or exemplars can be floats or Timestamp objects. Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
1 parent b44b63e commit 557d123

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

prometheus_client/samples.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Dict, NamedTuple, Optional
1+
from typing import Dict, NamedTuple, Optional, Union
22

33

44
class Timestamp:
@@ -39,12 +39,12 @@ def __gt__(self, other):
3939
class Exemplar(NamedTuple):
4040
labels: Dict[str, str]
4141
value: float
42-
timestamp: Optional[float] = None
42+
timestamp: Optional[Union[float, Timestamp]] = None
4343

4444

4545
class Sample(NamedTuple):
4646
name: str
4747
labels: Dict[str, str]
4848
value: float
49-
timestamp: Optional[float] = None
49+
timestamp: Optional[Union[float, Timestamp]] = None
5050
exemplar: Optional[Exemplar] = None

0 commit comments

Comments
 (0)
0