Skip to content

Commit 0c1fc44

Browse files
committed
receive: enable ExportCreatedMetric in OTLP translator
Without ExportCreatedMetric, the StartTimeUnixNano field on OTLP counters and histograms was silently dropped during translation to Prometheus remote write. This broke counter reset detection for downstream systems that rely on the _created timestamp to distinguish a genuine counter reset from a fresh series. Setting ExportCreatedMetric: true in the otlptranslator.Settings causes the translator to emit a <metric>_created series carrying the StartTimeUnixNano value, matching the behaviour described in the Prometheus exposition format spec. Fixes #8637 Signed-off-by: Ali <alliasgher123@gmail.com>
1 parent 519da47 commit 0c1fc44

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/receive/handler_otlp.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ func (h *Handler) convertToPrometheusFormat(ctx context.Context, pmetrics pmetri
161161
AddMetricSuffixes: true,
162162
DisableTargetInfo: !h.options.OtlpEnableTargetInfo,
163163
PromoteResourceAttributes: h.options.OtlpResourceAttributes,
164+
// ExportCreatedMetric preserves StartTimeUnixNano from OTLP as a
165+
// _created timestamp, enabling correct counter reset detection by
166+
// downstream Prometheus-compatible systems.
167+
ExportCreatedMetric: true,
164168
}
165169

166170
annots, err := converter.FromMetrics(ctx, pmetrics, settings)

0 commit comments

Comments
 (0)