Skip to content

Commit 5aa8353

Browse files
committed
Add exemplar to datapoint
1 parent 9935e63 commit 5aa8353

File tree

1 file changed

+5
-1
lines changed
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal

1 file changed

+5
-1
lines changed

opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414

1515
# pylint: disable=unused-import
1616

17-
from dataclasses import asdict, dataclass
17+
from dataclasses import asdict, dataclass, field
1818
from json import dumps, loads
1919
from typing import Optional, Sequence, Union
2020

2121
# This kind of import is needed to avoid Sphinx errors.
2222
import opentelemetry.sdk.metrics._internal
23+
from opentelemetry.sdk.metrics._internal.exemplar import Exemplar
2324
from opentelemetry.sdk.resources import Resource
2425
from opentelemetry.sdk.util.instrumentation import InstrumentationScope
2526
from opentelemetry.util.types import Attributes
@@ -35,6 +36,7 @@ class NumberDataPoint:
3536
start_time_unix_nano: int
3637
time_unix_nano: int
3738
value: Union[int, float]
39+
exemplars: Sequence[Exemplar] = field(default_factory=list)
3840

3941
def to_json(self, indent=4) -> str:
4042
return dumps(asdict(self), indent=indent)
@@ -55,6 +57,7 @@ class HistogramDataPoint:
5557
explicit_bounds: Sequence[float]
5658
min: float
5759
max: float
60+
exemplars: Sequence[Exemplar] = field(default_factory=list)
5861

5962
def to_json(self, indent=4) -> str:
6063
return dumps(asdict(self), indent=indent)
@@ -85,6 +88,7 @@ class ExponentialHistogramDataPoint:
8588
flags: int
8689
min: float
8790
max: float
91+
exemplars: Sequence[Exemplar] = field(default_factory=list)
8892

8993
def to_json(self, indent=4) -> str:
9094
return dumps(asdict(self), indent=indent)

0 commit comments

Comments
 (0)