Describe your environment
Python 3.10. Docker compose.
opentelemetry-sdk = "1.12.0rc1"
opentelemetry-exporter-otlp = "1.12.0rc1"
opentelemetry-exporter-otlp-proto-grpc = "1.12.0rc1"
Steps to reproduce
Just following the getting started example...
from opentelemetry import metrics
from opentelemetry.metrics import (
Counter,
)
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader, ConsoleMetricExporter
exporter = ConsoleMetricExporter()
reader = PeriodicExportingMetricReader(exporter)
provider = MeterProvider(metric_readers=[reader])
metrics.set_meter_provider(provider)
meter = metrics.get_meter(__name__)
counter = meter.create_counter("test")
counter.add(1)
What is the expected behavior?
Metrics printed to console
What is the actual behavior?
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/export/__init__.py", line 404, in _receive_metrics
self._exporter.export(metrics_data, timeout_millis=timeout_millis)
File "/usr/local/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/export/__init__.py", line 121, in export
self.out.write(self.formatter(metrics_data))
File "/usr/local/lib/python3.10/site-packages/opentelemetry/sdk/metrics/_internal/export/__init__.py", line 109, in <lambda>
] = lambda metric: metric.to_json()
AttributeError: 'MetricsData' object has no attribute 'to_json'
Exception while exporting metrics 'MetricsData' object has no attribute 'to_json'
Additional context
Add any other context about the problem here.
Describe your environment
Python 3.10. Docker compose.
Steps to reproduce
Just following the getting started example...
What is the expected behavior?
Metrics printed to console
What is the actual behavior?
Additional context
Add any other context about the problem here.