We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`ExponentialHistogram` is missing the `to_json` method
The [`ExponentialHistorgram`](https://github.com/open-telemetry/opentelemetry-python/blob/3dfe2249cc4a203bf24578483b192fec7266596b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py#L93-L102) data point type was [somewhat recently added](https://github.com/open-telemetry/opentelemetry-python/pull/2964), and does not work with the `ConsoleMetricExporter` because it is missing a `to_json` method (which seems to be defined on the other data point types).

This is the stack trace I get locally:

```
Exception while exporting metrics 'ExponentialHistogram' object has no attribute 'to_json'
Traceback (most recent call last):
  File "/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/export/__init__.py", line 523, in _receive_metrics
    self._exporter.export(
  File "/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/export/__init__.py", line 163, in export
    self.out.write(self.formatter(metrics_data))
  File "/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/export/__init__.py", line 143, in <lambda>
    ] = lambda metrics_data: metrics_data.to_json()
  File "/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py", line 252, in to_json
    "resource_metrics": [
  File "/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py", line 253, in <listcomp>
    loads(resource_metrics.to_json(indent=indent))
  File "/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py", line 233, in to_json
    "scope_metrics": [
  File "/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py", line 234, in <listcomp>
    loads(scope_metrics.to_json(indent=indent))
  File "/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py", line 211, in to_json
    "metrics": [
  File "/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py", line 212, in <listcomp>
    loads(metric.to_json(indent=indent))
  File "/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py", line 193, in to_json
    "data": loads(self.data.to_json(indent=indent)),
AttributeError: 'ExponentialHistogram' object has no attribute 'to_json'
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py`
Content:
```
1 # Copyright The OpenTelemetry Authors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 # pylint: disable=unused-import
16 
17 from dataclasses import asdict, dataclass
18 from json import dumps, loads
19 from typing import Optional, Sequence, Union
20 
21 # This kind of import is needed to avoid Sphinx errors.
22 import opentelemetry.sdk.metrics._internal
23 from opentelemetry.sdk.resources import Resource
24 from opentelemetry.sdk.util.instrumentation import InstrumentationScope
25 from opentelemetry.util.types import Attributes
26 
27 
28 @dataclass(frozen=True)
29 class NumberDataPoint:
30     """Single data point in a timeseries that describes the time-varying scalar
31     value of a metric.
32     """
33 
34     attributes: Attributes
35     start_time_unix_nano: int
36     time_unix_nano: int
37     value: Union[int, float]
38 
39     def to_json(self, indent=4) -> str:
40         return dumps(asdict(self), indent=indent)
41 
42 
43 @dataclass(frozen=True)
44 class HistogramDataPoint:
45     """Single data point in a timeseries that describes the time-varying scalar
46     value of a metric.
47     """
48 
49     attributes: Attributes
50     start_time_unix_nano: int
51     time_unix_nano: int
52     count: int
53     sum: Union[int, float]
54     bucket_counts: Sequence[int]
55     explicit_bounds: Sequence[float]
56     min: float
57     max: float
58 
59     def to_json(self, indent=4) -> str:
60         return dumps(asdict(self), indent=indent)
61 
62 
63 @dataclass(frozen=True)
64 class Buckets:
65     offset: int
66     bucket_counts: Sequence[int]
67 
68 
69 @dataclass(frozen=True)
70 class ExponentialHistogramDataPoint:
71     """Single data point in a timeseries whose boundaries are defined by an
72     exponential function. This timeseries describes the time-varying scalar
73     value of a metric.
74     """
75 
76     attributes: Attributes
77     start_time_unix_nano: int
78     time_unix_nano: int
79     count: int
80     sum: Union[int, float]
81     scale: int
82     zero_count: int
83     positive: Buckets
84     negative: Buckets
85     flags: int
86     min: float
87     max: float
88 
89     def to_json(self, indent=4) -> str:
90         return dumps(asdict(self), indent=indent)
91 
92 
93 @dataclass(frozen=True)
94 class ExponentialHistogram:
95     """Represents the type of a metric that is calculated by aggregating as an
96     ExponentialHistogram of all reported measurements over a time interval.
97     """
98 
99     data_points: Sequence[ExponentialHistogramDataPoint]
100     aggregation_temporality: (
101         "opentelemetry.sdk.metrics.export.AggregationTemporality"
102     )
103 
104 
105 @dataclass(frozen=True)
106 class Sum:
107     """Represents the type of a scalar metric that is calculated as a sum of
108     all reported measurements over a time interval."""
109 
110     data_points: Sequence[NumberDataPoint]
111     aggregation_temporality: (
112         "opentelemetry.sdk.metrics.export.AggregationTemporality"
113     )
114     is_monotonic: bool
115 
116     def to_json(self, indent=4) -> str:
117         return dumps(
118             {
119                 "data_points": [
120                     loads(data_point.to_json(indent=indent))
121                     for data_point in self.data_points
122                 ],
123                 "aggregation_temporality": self.aggregation_temporality,
124                 "is_monotonic": self.is_monotonic,
125             },
126             indent=indent,
127         )
128 
129 
130 @dataclass(frozen=True)
131 class Gauge:
132     """Represents the type of a scalar metric that always exports the current
133     value for every data point. It should be used for an unknown
134     aggregation."""
135 
136     data_points: Sequence[NumberDataPoint]
137 
138     def to_json(self, indent=4) -> str:
139         return dumps(
140             {
141                 "data_points": [
142                     loads(data_point.to_json(indent=indent))
143                     for data_point in self.data_points
144                 ],
145             },
146             indent=indent,
147         )
148 
149 
150 @dataclass(frozen=True)
151 class Histogram:
152     """Represents the type of a metric that is calculated by aggregating as a
153     histogram of all reported measurements over a time interval."""
154 
155     data_points: Sequence[HistogramDataPoint]
156     aggregation_temporality: (
157         "opentelemetry.sdk.metrics.export.AggregationTemporality"
158     )
159 
160     def to_json(self, indent=4) -> str:
161         return dumps(
162             {
163                 "data_points": [
164                     loads(data_point.to_json(indent=indent))
165                     for data_point in self.data_points
166                 ],
167                 "aggregation_temporality": self.aggregation_temporality,
168             },
169             indent=indent,
170         )
171 
172 
173 # pylint: disable=invalid-name
174 DataT = Union[Sum, Gauge, Histogram]
175 DataPointT = Union[NumberDataPoint, HistogramDataPoint]
176 
177 
178 @dataclass(frozen=True)
179 class Metric:
180     """Represents a metric point in the OpenTelemetry data model to be
181     exported."""
182 
183     name: str
184     description: Optional[str]
185     unit: Optional[str]
186     data: DataT
187 
188     def to_json(self, indent=4) -> str:
189         return dumps(
190             {
191                 "name": self.name,
192                 "description": self.description or "",
193                 "unit": self.unit or "",
194                 "data": loads(self.data.to_json(indent=indent)),
195             },
196             indent=indent,
197         )
198 
199 
200 @dataclass(frozen=True)
201 class ScopeMetrics:
202     """A collection of Metrics produced by a scope"""
203 
204     scope: InstrumentationScope
205     metrics: Sequence[Metric]
206     schema_url: str
207 
208     def to_json(self, indent=4) -> str:
209         return dumps(
210             {
211                 "scope": loads(self.scope.to_json(indent=indent)),
212                 "metrics": [
213                     loads(metric.to_json(indent=indent))
214                     for metric in self.metrics
215                 ],
216                 "schema_url": self.schema_url,
217             },
218             indent=indent,
219         )
220 
221 
222 @dataclass(frozen=True)
223 class ResourceMetrics:
224     """A collection of ScopeMetrics from a Resource"""
225 
226     resource: Resource
227     scope_metrics: Sequence[ScopeMetrics]
228     schema_url: str
229 
230     def to_json(self, indent=4) -> str:
231         return dumps(
232             {
233                 "resource": loads(self.resource.to_json(indent=indent)),
234                 "scope_metrics": [
235                     loads(scope_metrics.to_json(indent=indent))
236                     for scope_metrics in self.scope_metrics
237                 ],
238                 "schema_url": self.schema_url,
239             },
240             indent=indent,
241         )
242 
243 
244 @dataclass(frozen=True)
245 class MetricsData:
246     """An array of ResourceMetrics"""
247 
248     resource_metrics: Sequence[ResourceMetrics]
249 
250     def to_json(self, indent=4) -> str:
251         return dumps(
252             {
253                 "resource_metrics": [
254                     loads(resource_metrics.to_json(indent=indent))
255                     for resource_metrics in self.resource_metrics
256                 ]
257             },
258             indent=indent,
259         )
260
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py
--- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py
+++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py
@@ -101,6 +101,18 @@
         "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:

{"golden_diff": "diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py\n--- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py\n+++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py\n@@ -101,6 +101,18 @@\n         \"opentelemetry.sdk.metrics.export.AggregationTemporality\"\n     )\n \n+    def to_json(self, indent=4) -> str:\n+        return dumps(\n+            {\n+                \"data_points\": [\n+                    loads(data_point.to_json(indent=indent))\n+                    for data_point in self.data_points\n+                ],\n+                \"aggregation_temporality\": self.aggregation_temporality,\n+            },\n+            indent=indent,\n+        )\n+\n \n @dataclass(frozen=True)\n class Sum:\n", "issue": "`ExponentialHistogram` is missing the `to_json` method\nThe [`ExponentialHistorgram`](https://github.com/open-telemetry/opentelemetry-python/blob/3dfe2249cc4a203bf24578483b192fec7266596b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py#L93-L102) data point type was [somewhat recently added](https://github.com/open-telemetry/opentelemetry-python/pull/2964), and does not work with the `ConsoleMetricExporter` because it is missing a `to_json` method (which seems to be defined on the other data point types).\r\n\r\nThis is the stack trace I get locally:\r\n\r\n```\r\nException while exporting metrics 'ExponentialHistogram' object has no attribute 'to_json'\r\nTraceback (most recent call last):\r\n  File \"/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/export/__init__.py\", line 523, in _receive_metrics\r\n    self._exporter.export(\r\n  File \"/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/export/__init__.py\", line 163, in export\r\n    self.out.write(self.formatter(metrics_data))\r\n  File \"/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/export/__init__.py\", line 143, in <lambda>\r\n    ] = lambda metrics_data: metrics_data.to_json()\r\n  File \"/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py\", line 252, in to_json\r\n    \"resource_metrics\": [\r\n  File \"/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py\", line 253, in <listcomp>\r\n    loads(resource_metrics.to_json(indent=indent))\r\n  File \"/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py\", line 233, in to_json\r\n    \"scope_metrics\": [\r\n  File \"/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py\", line 234, in <listcomp>\r\n    loads(scope_metrics.to_json(indent=indent))\r\n  File \"/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py\", line 211, in to_json\r\n    \"metrics\": [\r\n  File \"/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py\", line 212, in <listcomp>\r\n    loads(metric.to_json(indent=indent))\r\n  File \"/home/closeio/venv/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/point.py\", line 193, in to_json\r\n    \"data\": loads(self.data.to_json(indent=indent)),\r\nAttributeError: 'ExponentialHistogram' object has no attribute 'to_json'\r\n```\n", "before_files": [{"content": "# Copyright The OpenTelemetry Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# pylint: disable=unused-import\n\nfrom dataclasses import asdict, dataclass\nfrom json import dumps, loads\nfrom typing import Optional, Sequence, Union\n\n# This kind of import is needed to avoid Sphinx errors.\nimport opentelemetry.sdk.metrics._internal\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.util.instrumentation import InstrumentationScope\nfrom opentelemetry.util.types import Attributes\n\n\n@dataclass(frozen=True)\nclass NumberDataPoint:\n    \"\"\"Single data point in a timeseries that describes the time-varying scalar\n    value of a metric.\n    \"\"\"\n\n    attributes: Attributes\n    start_time_unix_nano: int\n    time_unix_nano: int\n    value: Union[int, float]\n\n    def to_json(self, indent=4) -> str:\n        return dumps(asdict(self), indent=indent)\n\n\n@dataclass(frozen=True)\nclass HistogramDataPoint:\n    \"\"\"Single data point in a timeseries that describes the time-varying scalar\n    value of a metric.\n    \"\"\"\n\n    attributes: Attributes\n    start_time_unix_nano: int\n    time_unix_nano: int\n    count: int\n    sum: Union[int, float]\n    bucket_counts: Sequence[int]\n    explicit_bounds: Sequence[float]\n    min: float\n    max: float\n\n    def to_json(self, indent=4) -> str:\n        return dumps(asdict(self), indent=indent)\n\n\n@dataclass(frozen=True)\nclass Buckets:\n    offset: int\n    bucket_counts: Sequence[int]\n\n\n@dataclass(frozen=True)\nclass ExponentialHistogramDataPoint:\n    \"\"\"Single data point in a timeseries whose boundaries are defined by an\n    exponential function. This timeseries describes the time-varying scalar\n    value of a metric.\n    \"\"\"\n\n    attributes: Attributes\n    start_time_unix_nano: int\n    time_unix_nano: int\n    count: int\n    sum: Union[int, float]\n    scale: int\n    zero_count: int\n    positive: Buckets\n    negative: Buckets\n    flags: int\n    min: float\n    max: float\n\n    def to_json(self, indent=4) -> str:\n        return dumps(asdict(self), indent=indent)\n\n\n@dataclass(frozen=True)\nclass ExponentialHistogram:\n    \"\"\"Represents the type of a metric that is calculated by aggregating as an\n    ExponentialHistogram of all reported measurements over a time interval.\n    \"\"\"\n\n    data_points: Sequence[ExponentialHistogramDataPoint]\n    aggregation_temporality: (\n        \"opentelemetry.sdk.metrics.export.AggregationTemporality\"\n    )\n\n\n@dataclass(frozen=True)\nclass Sum:\n    \"\"\"Represents the type of a scalar metric that is calculated as a sum of\n    all reported measurements over a time interval.\"\"\"\n\n    data_points: Sequence[NumberDataPoint]\n    aggregation_temporality: (\n        \"opentelemetry.sdk.metrics.export.AggregationTemporality\"\n    )\n    is_monotonic: bool\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"data_points\": [\n                    loads(data_point.to_json(indent=indent))\n                    for data_point in self.data_points\n                ],\n                \"aggregation_temporality\": self.aggregation_temporality,\n                \"is_monotonic\": self.is_monotonic,\n            },\n            indent=indent,\n        )\n\n\n@dataclass(frozen=True)\nclass Gauge:\n    \"\"\"Represents the type of a scalar metric that always exports the current\n    value for every data point. It should be used for an unknown\n    aggregation.\"\"\"\n\n    data_points: Sequence[NumberDataPoint]\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"data_points\": [\n                    loads(data_point.to_json(indent=indent))\n                    for data_point in self.data_points\n                ],\n            },\n            indent=indent,\n        )\n\n\n@dataclass(frozen=True)\nclass Histogram:\n    \"\"\"Represents the type of a metric that is calculated by aggregating as a\n    histogram of all reported measurements over a time interval.\"\"\"\n\n    data_points: Sequence[HistogramDataPoint]\n    aggregation_temporality: (\n        \"opentelemetry.sdk.metrics.export.AggregationTemporality\"\n    )\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"data_points\": [\n                    loads(data_point.to_json(indent=indent))\n                    for data_point in self.data_points\n                ],\n                \"aggregation_temporality\": self.aggregation_temporality,\n            },\n            indent=indent,\n        )\n\n\n# pylint: disable=invalid-name\nDataT = Union[Sum, Gauge, Histogram]\nDataPointT = Union[NumberDataPoint, HistogramDataPoint]\n\n\n@dataclass(frozen=True)\nclass Metric:\n    \"\"\"Represents a metric point in the OpenTelemetry data model to be\n    exported.\"\"\"\n\n    name: str\n    description: Optional[str]\n    unit: Optional[str]\n    data: DataT\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"name\": self.name,\n                \"description\": self.description or \"\",\n                \"unit\": self.unit or \"\",\n                \"data\": loads(self.data.to_json(indent=indent)),\n            },\n            indent=indent,\n        )\n\n\n@dataclass(frozen=True)\nclass ScopeMetrics:\n    \"\"\"A collection of Metrics produced by a scope\"\"\"\n\n    scope: InstrumentationScope\n    metrics: Sequence[Metric]\n    schema_url: str\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"scope\": loads(self.scope.to_json(indent=indent)),\n                \"metrics\": [\n                    loads(metric.to_json(indent=indent))\n                    for metric in self.metrics\n                ],\n                \"schema_url\": self.schema_url,\n            },\n            indent=indent,\n        )\n\n\n@dataclass(frozen=True)\nclass ResourceMetrics:\n    \"\"\"A collection of ScopeMetrics from a Resource\"\"\"\n\n    resource: Resource\n    scope_metrics: Sequence[ScopeMetrics]\n    schema_url: str\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"resource\": loads(self.resource.to_json(indent=indent)),\n                \"scope_metrics\": [\n                    loads(scope_metrics.to_json(indent=indent))\n                    for scope_metrics in self.scope_metrics\n                ],\n                \"schema_url\": self.schema_url,\n            },\n            indent=indent,\n        )\n\n\n@dataclass(frozen=True)\nclass MetricsData:\n    \"\"\"An array of ResourceMetrics\"\"\"\n\n    resource_metrics: Sequence[ResourceMetrics]\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"resource_metrics\": [\n                    loads(resource_metrics.to_json(indent=indent))\n                    for resource_metrics in self.resource_metrics\n                ]\n            },\n            indent=indent,\n        )\n", "path": "opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py"}], "after_files": [{"content": "# Copyright The OpenTelemetry Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# pylint: disable=unused-import\n\nfrom dataclasses import asdict, dataclass\nfrom json import dumps, loads\nfrom typing import Optional, Sequence, Union\n\n# This kind of import is needed to avoid Sphinx errors.\nimport opentelemetry.sdk.metrics._internal\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.util.instrumentation import InstrumentationScope\nfrom opentelemetry.util.types import Attributes\n\n\n@dataclass(frozen=True)\nclass NumberDataPoint:\n    \"\"\"Single data point in a timeseries that describes the time-varying scalar\n    value of a metric.\n    \"\"\"\n\n    attributes: Attributes\n    start_time_unix_nano: int\n    time_unix_nano: int\n    value: Union[int, float]\n\n    def to_json(self, indent=4) -> str:\n        return dumps(asdict(self), indent=indent)\n\n\n@dataclass(frozen=True)\nclass HistogramDataPoint:\n    \"\"\"Single data point in a timeseries that describes the time-varying scalar\n    value of a metric.\n    \"\"\"\n\n    attributes: Attributes\n    start_time_unix_nano: int\n    time_unix_nano: int\n    count: int\n    sum: Union[int, float]\n    bucket_counts: Sequence[int]\n    explicit_bounds: Sequence[float]\n    min: float\n    max: float\n\n    def to_json(self, indent=4) -> str:\n        return dumps(asdict(self), indent=indent)\n\n\n@dataclass(frozen=True)\nclass Buckets:\n    offset: int\n    bucket_counts: Sequence[int]\n\n\n@dataclass(frozen=True)\nclass ExponentialHistogramDataPoint:\n    \"\"\"Single data point in a timeseries whose boundaries are defined by an\n    exponential function. This timeseries describes the time-varying scalar\n    value of a metric.\n    \"\"\"\n\n    attributes: Attributes\n    start_time_unix_nano: int\n    time_unix_nano: int\n    count: int\n    sum: Union[int, float]\n    scale: int\n    zero_count: int\n    positive: Buckets\n    negative: Buckets\n    flags: int\n    min: float\n    max: float\n\n    def to_json(self, indent=4) -> str:\n        return dumps(asdict(self), indent=indent)\n\n\n@dataclass(frozen=True)\nclass ExponentialHistogram:\n    \"\"\"Represents the type of a metric that is calculated by aggregating as an\n    ExponentialHistogram of all reported measurements over a time interval.\n    \"\"\"\n\n    data_points: Sequence[ExponentialHistogramDataPoint]\n    aggregation_temporality: (\n        \"opentelemetry.sdk.metrics.export.AggregationTemporality\"\n    )\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"data_points\": [\n                    loads(data_point.to_json(indent=indent))\n                    for data_point in self.data_points\n                ],\n                \"aggregation_temporality\": self.aggregation_temporality,\n            },\n            indent=indent,\n        )\n\n\n@dataclass(frozen=True)\nclass Sum:\n    \"\"\"Represents the type of a scalar metric that is calculated as a sum of\n    all reported measurements over a time interval.\"\"\"\n\n    data_points: Sequence[NumberDataPoint]\n    aggregation_temporality: (\n        \"opentelemetry.sdk.metrics.export.AggregationTemporality\"\n    )\n    is_monotonic: bool\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"data_points\": [\n                    loads(data_point.to_json(indent=indent))\n                    for data_point in self.data_points\n                ],\n                \"aggregation_temporality\": self.aggregation_temporality,\n                \"is_monotonic\": self.is_monotonic,\n            },\n            indent=indent,\n        )\n\n\n@dataclass(frozen=True)\nclass Gauge:\n    \"\"\"Represents the type of a scalar metric that always exports the current\n    value for every data point. It should be used for an unknown\n    aggregation.\"\"\"\n\n    data_points: Sequence[NumberDataPoint]\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"data_points\": [\n                    loads(data_point.to_json(indent=indent))\n                    for data_point in self.data_points\n                ],\n            },\n            indent=indent,\n        )\n\n\n@dataclass(frozen=True)\nclass Histogram:\n    \"\"\"Represents the type of a metric that is calculated by aggregating as a\n    histogram of all reported measurements over a time interval.\"\"\"\n\n    data_points: Sequence[HistogramDataPoint]\n    aggregation_temporality: (\n        \"opentelemetry.sdk.metrics.export.AggregationTemporality\"\n    )\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"data_points\": [\n                    loads(data_point.to_json(indent=indent))\n                    for data_point in self.data_points\n                ],\n                \"aggregation_temporality\": self.aggregation_temporality,\n            },\n            indent=indent,\n        )\n\n\n# pylint: disable=invalid-name\nDataT = Union[Sum, Gauge, Histogram]\nDataPointT = Union[NumberDataPoint, HistogramDataPoint]\n\n\n@dataclass(frozen=True)\nclass Metric:\n    \"\"\"Represents a metric point in the OpenTelemetry data model to be\n    exported.\"\"\"\n\n    name: str\n    description: Optional[str]\n    unit: Optional[str]\n    data: DataT\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"name\": self.name,\n                \"description\": self.description or \"\",\n                \"unit\": self.unit or \"\",\n                \"data\": loads(self.data.to_json(indent=indent)),\n            },\n            indent=indent,\n        )\n\n\n@dataclass(frozen=True)\nclass ScopeMetrics:\n    \"\"\"A collection of Metrics produced by a scope\"\"\"\n\n    scope: InstrumentationScope\n    metrics: Sequence[Metric]\n    schema_url: str\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"scope\": loads(self.scope.to_json(indent=indent)),\n                \"metrics\": [\n                    loads(metric.to_json(indent=indent))\n                    for metric in self.metrics\n                ],\n                \"schema_url\": self.schema_url,\n            },\n            indent=indent,\n        )\n\n\n@dataclass(frozen=True)\nclass ResourceMetrics:\n    \"\"\"A collection of ScopeMetrics from a Resource\"\"\"\n\n    resource: Resource\n    scope_metrics: Sequence[ScopeMetrics]\n    schema_url: str\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"resource\": loads(self.resource.to_json(indent=indent)),\n                \"scope_metrics\": [\n                    loads(scope_metrics.to_json(indent=indent))\n                    for scope_metrics in self.scope_metrics\n                ],\n                \"schema_url\": self.schema_url,\n            },\n            indent=indent,\n        )\n\n\n@dataclass(frozen=True)\nclass MetricsData:\n    \"\"\"An array of ResourceMetrics\"\"\"\n\n    resource_metrics: Sequence[ResourceMetrics]\n\n    def to_json(self, indent=4) -> str:\n        return dumps(\n            {\n                \"resource_metrics\": [\n                    loads(resource_metrics.to_json(indent=indent))\n                    for resource_metrics in self.resource_metrics\n                ]\n            },\n            indent=indent,\n        )\n", "path": "opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py"}]}