diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index 6bcb3bff88..f99cc9db3f 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -308,10 +308,6 @@ func (c *flagConfig) setFeatureListOptions(logger *slog.Logger) error { return errors.New("cannot enable otlp-deltatocumulative and otlp-native-delta-ingestion features at the same time") } - if c.web.NativeOTLPDeltaIngestion && !c.web.EnableTypeAndUnitLabels { - return errors.New("cannot enable otlp-native-delta-ingestion feature without enabling type and unit labels feature") - } - return nil } diff --git a/docs/feature_flags.md b/docs/feature_flags.md index fce044bc3c..a8d0edf123 100644 --- a/docs/feature_flags.md +++ b/docs/feature_flags.md @@ -239,7 +239,7 @@ Examples of equivalent durations: `--enable-feature=otlp-native-delta-ingestion` -When enabled, allows for the native ingestion of delta OTLP metrics, storing the raw sample values without conversion. This cannot be enabled in conjunction with `otlp-deltatocumulative`, and `type-and-unit-labels` must be enabled. +When enabled, allows for the native ingestion of delta OTLP metrics, storing the raw sample values without conversion. This cannot be enabled in conjunction with `otlp-deltatocumulative`. It is recommended to enable `type-and-unit-labels`. Currently, the StartTimeUnixNano field is ignored. Delta metrics are given a `__temporality__` label with a value of "delta" and a `__type__` label with a value of "gauge"/"gaugehistogram". diff --git a/storage/remote/otlptranslator/prometheusremotewrite/helper.go b/storage/remote/otlptranslator/prometheusremotewrite/helper.go index 4163de2482..d7a13e36f8 100644 --- a/storage/remote/otlptranslator/prometheusremotewrite/helper.go +++ b/storage/remote/otlptranslator/prometheusremotewrite/helper.go @@ -211,20 +211,18 @@ func createAttributes(resource pcommon.Resource, attributes pcommon.Map, scope s unitNamer := otlptranslator.UnitNamer{UTF8Allowed: settings.AllowUTF8} if metadata.Type != prompb.MetricMetadata_UNKNOWN { - typeValue := strings.ToLower(metadata.Type.String()) - l["__type__"] = typeValue + l["__type__"] = strings.ToLower(metadata.Type.String()) } if metadata.Unit != "" { l["__unit__"] = unitNamer.Build(metadata.Unit) } - - if settings.AllowDeltaTemporality && hasTemporality { - switch temporality { - case pmetric.AggregationTemporalityCumulative: - l["__temporality__"] = "cumulative" - case pmetric.AggregationTemporalityDelta: - l["__temporality__"] = "delta" - } + } + if settings.AllowDeltaTemporality && hasTemporality { + switch temporality { + case pmetric.AggregationTemporalityCumulative: + l["__temporality__"] = "cumulative" + case pmetric.AggregationTemporalityDelta: + l["__temporality__"] = "delta" } } diff --git a/storage/remote/write_handler.go b/storage/remote/write_handler.go index 9c86abf4c6..81e2681088 100644 --- a/storage/remote/write_handler.go +++ b/storage/remote/write_handler.go @@ -545,11 +545,6 @@ func NewOTLPWriteHandler(logger *slog.Logger, _ prometheus.Registerer, appendabl panic("cannot enable native delta ingestion and delta2cumulative conversion at the same time") } - if opts.NativeDelta && !opts.EnableTypeAndUnitLabels { - // This should be validated when iterating through feature flags, so not expected to fail here. - panic("cannot enable native delta ingestion without enabling type and unit labels") - } - ex := &rwExporter{ writeHandler: &writeHandler{ logger: logger,