Skip to content

Commit

Permalink
Add to_json method to ExponentialHistogram
Browse files Browse the repository at this point in the history
  • Loading branch information
rbtz-openai committed Mar 13, 2024
1 parent 8ed71b1 commit 4eb5d57
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ class ExponentialHistogram:
"opentelemetry.sdk.metrics.export.AggregationTemporality"
)

def to_json(self, indent=4) -> str:
return dumps(
{
"data_points": [
loads(data_point.to_json(indent=indent))
for data_point in self.data_points
],
"aggregation_temporality": self.aggregation_temporality,
},
indent=indent,
)


@dataclass(frozen=True)
class Sum:
Expand Down

0 comments on commit 4eb5d57

Please sign in to comment.