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

prometheusremotewrite: support for converting OTLP exponential histogram to Prometheus Native Histograms #16207

Closed
hardproblems opened this issue Nov 9, 2022 · 2 comments · Fixed by #17370
Assignees

Comments

@hardproblems
Copy link
Contributor

Component(s)

exporter/prometheusremotewrite

Is your feature request related to a problem? Please describe.

Prometheus native histograms have just been released (https://github.com/prometheus/prometheus/releases/tag/v2.40.0). They can be converted to/from OTLP exponential histograms losslessly. Right now prometheusremotewriteexporter simply drops all OTLP exponential histogram metrics. This feature request is for adding the ability to convert OTLP exponential histograms to Prometheus Native Histograms in prometheusremotewriteexporter.

Describe the solution you'd like

In go.mod, update github.com/prometheus/prometheus v0.38.0 to v0.40.0 to pull in native histogram support
Add case to https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/translator/prometheusremotewrite/helper.go#L247 for metrics.ExponentialHistogram
Add a case for ExponentialHistogram to https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/translator/prometheusremotewrite/metrics_to_prw.go#L71. Should be straightforward to copy OTLP PostiveBuckets to Prometheus Positive Spans, etc.
Add test cases

Describe alternatives you've considered

No response

Additional context

No response

@hardproblems hardproblems added enhancement New feature or request needs triage New item requiring triage labels Nov 9, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2022

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2022

Pinging code owners: @Aneurysm9. See Adding Labels via Comments if you do not have permissions to add labels yourself.

codeboten pushed a commit that referenced this issue Jan 12, 2023
…l Histogram to Prometheus Native Histogram (#17370)

Support conversion of OTel Exponential Histogram to Prometheus Native Histogram.

pmetric.ExponentialHistogramDataPoint translates to prompb.Histogram as follows:

- Exp. Scale -> Nat. Schema: histogram is dropped if Scale -4 < and > 8.
- TODO: We can potentially downscale hist to 8 if Scale > 8? (as a separate PR)
- Exp. Count -> Nat. Count: if Flags().NoRecordedValue() is false
- Exp. Sum_ -> Nat. Sum: if it Sum is set and Flags().NoRecordedValue() is false
- Exp. TimeUnixNano -> Nat. Timestamp: TimeUnixNano ns converted Timestamp ms
- Exp. ZeroCount -> Nat. ZeroCount
- Nat. ZeroThreshold is set to the default value 1e-128, once opentelemetry-proto#441 is merged, we can use Exp. ZeroThreshold to set the value.
- Exp. Positive -> Nat. PositiveSpans and Nat. PositiveDeltas.
- Exp. Negative -> Nat. NegativeSpans and Nat. NegativeDeltas.
- Exp. Min_ and Max_ are not used.
- Exp. StartTimeUnixNano is not used.

Exp. Exemplars, Labels, and ExponentialHistogramDataPoint will be translated to native hist data structures and will make up one or more prompb.TimeSeries.

Link to tracking Issue:
Resolves #16207

Testing:
Unit tests in pkg/transalator/prometheusremote and exporter/prometheusremotewriteexporter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants