Skip to content

Metrics exporting without a trace regression in 1.28.0 #4250

@xrmx

Description

@xrmx

Describe your environment

OS: (e.g, Ubuntu)
Python version: (e.g., Python 3.8.10) Python 3.10
Package version: 1.28.0

What happened?

It looks like there is a regressions around metrics exporting

Steps to Reproduce

Please note that this is sending data to a collector, serializing to the console is working fine:

touch empty.py
opentelemetry-instrument python empty.py

Expected Result

Metrics exported

Actual Result

  File "/metricsregresions/lib/python3.10/site-packages/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py", line 189, in encode_metrics
    _encode_resource_metrics(resource_metrics, resource_metrics_dict)
  File "/metricsregresions/lib/python3.10/site-packages/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py", line 240, in _encode_resource_metrics
  File "/metricsregresions/lib/python3.10/site-packages/opentelemetry/exporter/otlp/proto/common/_internal/metrics_encoder/__init__.py", line 240, in _encode_resource_metrics
    raise EncodingException(ex, metric) from None
opentelemetry.exporter.otlp.proto.common._internal.metrics_encoder.EncodingException: Metric(name='process.runtime.cpython.memory', description='Runtime cpython memory', unit='By', data=Sum(data_points=[NumberDataPoint(attributes={'type': 'rss'}, start_time_unix_nano=1730892722110841083, time_unix_nano=1730892722111199546, value=44474368, exemplars=[Exemplar(filtered_attributes={}, value=44474368, time_unix_nano=1730892722110782542, span_id=None, trace_id=None)]), NumberDataPoint(attributes={'type': 'vms'}, start_time_unix_nano=1730892722110867031, time_unix_nano=1730892722111199546, value=1724026880, exemplars=[Exemplar(filtered_attributes={}, value=1724026880, time_unix_nano=1730892722110862362, span_id=None, trace_id=None)])], aggregation_temporality=<AggregationTemporality.CUMULATIVE: 2>, is_monotonic=False))
'NoneType' object has no attribute 'to_bytes'

Additional context

No response

Would you like to implement a fix?

Yes but I need to dig

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions