Skip to content

Commit

Permalink
Relax type constraints Timestamp
Browse files Browse the repository at this point in the history
Timestamps in samples or exemplars can be floats or Timestamp objects.

Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
  • Loading branch information
csmarchbanks committed Jan 28, 2022
1 parent b44b63e commit 557d123
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions prometheus_client/samples.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, NamedTuple, Optional
from typing import Dict, NamedTuple, Optional, Union


class Timestamp:
Expand Down Expand Up @@ -39,12 +39,12 @@ def __gt__(self, other):
class Exemplar(NamedTuple):
labels: Dict[str, str]
value: float
timestamp: Optional[float] = None
timestamp: Optional[Union[float, Timestamp]] = None


class Sample(NamedTuple):
name: str
labels: Dict[str, str]
value: float
timestamp: Optional[float] = None
timestamp: Optional[Union[float, Timestamp]] = None
exemplar: Optional[Exemplar] = None

0 comments on commit 557d123

Please sign in to comment.