Skip to content

OTLPMetricExporter ignores preferred_aggregation #3522

Description

@aj-patterson

Describe your environment Describe any aspect of your environment relevant to the problem, including your Python version, platform, version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main.

Python == 3.11.6
opentelemetry-exporter-otlp == 1.20.0
opentelemetry-sdk == 1.20.0

Steps to reproduce
Describe exactly how to reproduce the error. Include a code sample if applicable.

Instantiating metric exporter:

metric_reader = PeriodicExportingMetricReader(
    OTLPMetricExporter(
        endpoint=<>,
        preferred_aggregation={
            Histogram: ExponentialBucketHistogramAggregation()
        },
    ),
)
meter_provider = MeterProvider(
    resource=resource, metric_readers=[metric_reader]
)
metrics.set_meter_provider(meter_provider)

What is the expected behavior?
What did you expect to see?

Preferred aggregation set on the exporter and reader for Histograms to be ExponentialBucketHistogramAggregation.

What is the actual behavior?
What did you see instead?

Preferred aggregation set on the exporter and reader for Histograms is default (ExplicitBucketHistogramAggregation)

Additional context
Add any other context about the problem here.

Looking at the code in OTLPMetricExporter.init, it looks like the preferred_aggregation arg is not used at all.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions