Skip to content

otlp: drop untyped metrics and too coarse histograms instead of rejecting the request - #20568

Open
r0h1tb wants to merge 1 commit into
prometheus:mainfrom
r0h1tb:fix/otlp-drop-untranslatable-metrics
Open

r0h1tb wants to merge 1 commit into
prometheus:mainfrom
r0h1tb:fix/otlp-drop-untranslatable-metrics

Conversation

@r0h1tb

@r0h1tb r0h1tb commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Which issue(s) does the PR fix:

No issue filed. Follow-up to #20536, covering the two cases I mentioned there.

FromMetrics still returns an error for two inputs that only concern one metric, so ConsumeMetrics rolls back the whole OTLP request and the handler answers 500 (which senders retry):

  • a metric with no type (MetricTypeEmpty): could not get aggregation temporality for bad_metric as it has unsupported metric type Empty
  • an exponential histogram data point with a scale below -4, the lowest native histogram schema. OTLP allows scales down to -10, and SDKs go below -4 when the bucket limit is small and the values cover a wide range: cannot convert exponential to native histogram. Scale must be >= -4, was -5
request: Gauge "healthy_metric" + one of the above
main:    500, nothing stored
PR:      200, healthy_metric stored, one warning

Both now become warnings, as in #19343 and #20536. A metric with no type has no data points either, so it is reported like the empty data points case and counted as empty_data_points. A data point with a scale that is too low is dropped by itself, and the other data points of the metric are kept. It is counted under a new histogram_scale_too_low category of prometheus_api_otlp_translation_warnings_total.

Tests: in TestOTLPWriteHandler, both cases are added to "dropped metric does not reject healthy metrics" and to "translation warnings metric". Without the change, they get 500 or an error. TestTemporality had an "empty metric type errors" case, from the delta ingestion work in #16360. It now expects the warning and has a healthy metric next to the dropped one. exponentialToNativeHistogram keeps its scale check and its test.

Release notes for end users (ALL commits must be considered).

Reviewers should verify clarity and quality.

[BUGFIX] OTLP: Do not abort an entire OTLP payload ingestion if one metric has no type or an exponential histogram data point has a scale below -4. Only that metric or data point is dropped, with a warning.

…ting the request

FromMetrics still returned an error for two kinds of input that only
affect one metric: a metric with no type (MetricTypeEmpty), and an
exponential histogram data point with a scale below -4, the lowest
native histogram schema (OTLP allows scales down to -10). The handler
then rolled back the whole request and answered 500, so every other
metric in it was lost and the sender retried the same request.

Report both as warnings instead, as prometheus#19343 and prometheus#20536 did for empty data
points and unsupported temporality. A metric with no type has no data
points and is counted as empty_data_points. A data point with a too low
scale is dropped on its own and counted under a new
histogram_scale_too_low category.

Signed-off-by: Rohit Behera <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant