mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-06 14:17:12 +02:00
Do not require type and unit labels enabled to add temporality label per proposal update
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
This commit is contained in:
parent
6c064893e4
commit
1990beabe9
@ -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
|
||||
}
|
||||
|
||||
|
@ -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".
|
||||
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user