open-telemetry / opentelemetry-collector

OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
4.45k stars 1.47k forks source link

TemporalityPreference / DefaultHistogramAggregation are ignored #10745

Closed pirgeo closed 3 months ago

pirgeo commented 3 months ago

I recently tried configuring the OTLP exporter for internal telemetry in the OpenTelemetry collector. While doing that, I tried to set the TemporalityPreference for the exported telemetry, which is passed through to the initOTLPHTTPExporter and initOTLPgRPCExporter methods. However, when looking through the code, it seems like TemporalityPreference and DefaultHistogramAggregation are not converted to options to be passed on to the creation of the metrics exporter (https://github.com/open-telemetry/opentelemetry-collector/blob/main/service/internal/proctelemetry/config.go#L264, I assume this is where it would go). Also, setting these options does not affect the telemetry that the collector emits at all.

Is your feature request related to a problem? Please describe. TemporalityPreference and DefaultHistogramAggregation can't be set on the internal telemetry exporters.

Describe the solution you'd like temporality_preference and default_histogram_aggregation are passed to the exporter. I have created a branch but am unsure if this is how it's supposed to be done (using the metricdata package directly). I am happy to open a PR or hand off the code if you think this is the right approach.

codeboten commented 3 months ago

Thanks @pirgeo, feel free to open a PR to add the feature. I've opened a similar PR in the go contrib repo to add it to the config package as well https://github.com/open-telemetry/opentelemetry-go-contrib/pull/5860

pirgeo commented 3 months ago

Thanks, I might steal copy your tests :)