Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExponentialHistogram is missing the to_json method #3579

Closed
AlecRosenbaum opened this issue Dec 13, 2023 · 1 comment · Fixed by #3780
Closed

ExponentialHistogram is missing the to_json method #3579

AlecRosenbaum opened this issue Dec 13, 2023 · 1 comment · Fixed by #3780
Assignees
Labels
bug Something isn't working

Comments

@AlecRosenbaum
Copy link

The ExponentialHistorgram data point type was somewhat recently added, 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'
@AlecRosenbaum AlecRosenbaum added the bug Something isn't working label Dec 13, 2023
@ocelotl ocelotl self-assigned this Dec 14, 2023
@rbtz-openai
Copy link
Contributor

@ocelotl a friendly ping

(cc: @euroelessar @SaveTheRbtz)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants