Repository navigation
otlp: drop metrics with unsupported temporality instead of rejecting the request - #20536
Merged
aknuds1 merged 1 commit intoNov 23, 2026
Merged
Conversation
…the request Since prometheus#16951 (v3.7.0) any error from FromMetrics rolls back the whole OTLP request and answers 500. A delta metric sent without native delta ingestion returned such an error, so one delta metric dropped every other metric in the same request. Before v3.7.0 the error was only logged and the rest was written. Report the unsupported temporality as a warning, like prometheus#19343 did for metrics with no data points, so only that metric is dropped. It is counted in prometheus_api_otlp_translation_warnings_total{category="invalid_temporality"}. Signed-off-by: Rohit Behera <126186063+r0h1tb@users.noreply.github.com>
r0h1tb
requested review from
a team,
ArthurSens,
aknuds1,
bwplotka,
cstyan and
jesusvazquez
as code owners
November 22, 2026 10:58
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change to skip unsupported-temporality metrics without rejecting healthy metrics in the same request.
No open issues 🎉
What changed in this PR
Fixes an OTLP ingestion regression by dropping metrics with unsupported temporality without rejecting healthy metrics in the same request. This follows the warning-based handling already used for metrics with no data points.
Changes:
- Reports unsupported temporality as a categorized warning instead of a request-fatal error.
- Adds the
invalid_temporalitywarning category for translation monitoring. - Updates translator and handler tests to cover warnings and successful ingestion of mixed payloads.
| File | Description |
|---|---|
| storage/remote/write_otlp_handler_test.go | Tests warning counts and preservation of healthy metrics alongside dropped metrics. |
| storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go | Emits a warning and skips metrics with unsupported temporality. |
| storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw_test.go | Updates temporality cases to expect warnings rather than errors. |
| storage/remote/otlptranslator/prometheusremotewrite/annotations.go | Defines and documents the invalid_temporality warning category. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue(s) does the PR fix:
No issue filed. Same regression as #19338, with a different trigger.
Since #16951 (v3.7.0),
ConsumeMetricsrolls back the whole OTLP request whenFromMetricsreturns an error, and the handler answers 500. A delta metric sent withoutotlp-native-delta-ingestion(orotlp-deltatocumulative) is such an error, so one delta metric in a request drops every other metric in it:docs/feature_flags.mddescribes delta metrics as dropped without the flag, andTestTemporalityalready expectstest_metric_1to be appended in "delta rejected when not allowed". The test commits the appender even whenFromMetricsreturns an error, so it did not catch this. Mixed requests are common: SDKs configured to prefer delta, or a collector batching metrics from several services.This reports the unsupported temporality as a warning instead of an error, the way #19343 handled metrics with no data points, so only that metric is dropped. The warning is counted in
prometheus_api_otlp_translation_warnings_total{category="invalid_temporality"}.Tests:
TestTemporalitynow checks the warnings, and its 5 invalid-temporality cases expect a warning instead of an error. InTestOTLPWriteHandlerthe "empty metric does not reject healthy metrics" case is now a table with an empty-data-points case and a delta case, and "translation warnings metric" has aninvalid_temporalitycase. Without the change the handler test gets 500 instead of 200. I also checked it throughNewOTLPWriteHandlerinto a real TSDB: nothing stored before,good_totalstored after.Other errors from
FromMetricsstill roll back the request, for example an exponential histogram with scale below -4 or a metric with no type. I left those alone to keep this focused. I can convert them here too if you prefer.Release notes for end users (ALL commits must be considered).
Reviewers should verify clarity and quality.