From f1d3c3f46468e97f5bad0aa0004f9e5775eb3429 Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Tue, 3 Sep 2024 08:33:44 +0200 Subject: [PATCH] fix: Properly put OM text p.CreatedTimestamp behind feature flag (#14809) (#14815) Mitigates https://github.com/prometheus/prometheus/issues/14808 Signed-off-by: Manik Rana Co-authored-by: Manik Rana --- scrape/scrape.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scrape/scrape.go b/scrape/scrape.go index 5fcd623c0..2abd4691d 100644 --- a/scrape/scrape.go +++ b/scrape/scrape.go @@ -1655,12 +1655,14 @@ loop: if seriesAlreadyScraped && parsedTimestamp == nil { err = storage.ErrDuplicateSampleForTimestamp } else { - if ctMs := p.CreatedTimestamp(); sl.enableCTZeroIngestion && ctMs != nil { - ref, err = app.AppendCTZeroSample(ref, lset, t, *ctMs) - if err != nil && !errors.Is(err, storage.ErrOutOfOrderCT) { // OOO is a common case, ignoring completely for now. - // CT is an experimental feature. For now, we don't need to fail the - // scrape on errors updating the created timestamp, log debug. - level.Debug(sl.l).Log("msg", "Error when appending CT in scrape loop", "series", string(met), "ct", *ctMs, "t", t, "err", err) + if sl.enableCTZeroIngestion { + if ctMs := p.CreatedTimestamp(); ctMs != nil { + ref, err = app.AppendCTZeroSample(ref, lset, t, *ctMs) + if err != nil && !errors.Is(err, storage.ErrOutOfOrderCT) { // OOO is a common case, ignoring completely for now. + // CT is an experimental feature. For now, we don't need to fail the + // scrape on errors updating the created timestamp, log debug. + level.Debug(sl.l).Log("msg", "Error when appending CT in scrape loop", "series", string(met), "ct", *ctMs, "t", t, "err", err) + } } }