Problem Statement
We currently drop exponential histograms in the prometheus exporter:
|
switch v := m.Data.(type) { |
|
case metricdata.Histogram[int64]: |
|
addHistogramMetric(ch, v, m, keys, values, name, c.resourceKeyVals) |
|
case metricdata.Histogram[float64]: |
|
addHistogramMetric(ch, v, m, keys, values, name, c.resourceKeyVals) |
|
case metricdata.Sum[int64]: |
|
addSumMetric(ch, v, m, keys, values, name, c.resourceKeyVals) |
|
case metricdata.Sum[float64]: |
|
addSumMetric(ch, v, m, keys, values, name, c.resourceKeyVals) |
|
case metricdata.Gauge[int64]: |
|
addGaugeMetric(ch, v, m, keys, values, name, c.resourceKeyVals) |
|
case metricdata.Gauge[float64]: |
|
addGaugeMetric(ch, v, m, keys, values, name, c.resourceKeyVals) |
|
} |
Proposed Solution
We should convert them to prometheus native histograms per https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/compatibility/prometheus_and_openmetrics.md#exponential-histograms
Additional Context
Related to open-telemetry/opentelemetry-collector-contrib#33703
This is currently difficult to do because we use prometheus.NewConstHistogram here:
|
m, err := prometheus.NewConstHistogram(desc, dp.Count, float64(dp.Sum), buckets, values...) |
There is no NewConstNativeHistogram in the prometheus client. We would currently need to implement the prometheus.Metric interface directly, which is a bit more work.
Problem Statement
We currently drop exponential histograms in the prometheus exporter:
opentelemetry-go/exporters/prometheus/exporter.go
Lines 226 to 239 in 48fedfa
Proposed Solution
We should convert them to prometheus native histograms per https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/compatibility/prometheus_and_openmetrics.md#exponential-histograms
Additional Context
Related to open-telemetry/opentelemetry-collector-contrib#33703
This is currently difficult to do because we use prometheus.NewConstHistogram here:
opentelemetry-go/exporters/prometheus/exporter.go
Line 256 in 48fedfa
There is no NewConstNativeHistogram in the prometheus client. We would currently need to implement the prometheus.Metric interface directly, which is a bit more work.