From 2820e327db03461b394d8d1677f0780e024af653 Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar Date: Wed, 28 Dec 2022 14:48:39 +0530 Subject: [PATCH] tsdb: Add staleness handling for FloatHistogram Signed-off-by: Ganesh Vernekar --- tsdb/head_append.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tsdb/head_append.go b/tsdb/head_append.go index 72a57af3cf..c09027ae48 100644 --- a/tsdb/head_append.go +++ b/tsdb/head_append.go @@ -350,9 +350,12 @@ func (a *headAppender) Append(ref storage.SeriesRef, lset labels.Labels, t int64 } } - if value.IsStaleNaN(v) && s.lastHistogramValue != nil { - // TODO(marctc): do we have do to the same for float histograms? - return a.AppendHistogram(ref, lset, t, &histogram.Histogram{Sum: v}, nil) + if value.IsStaleNaN(v) { + if s.lastHistogramValue != nil { + return a.AppendHistogram(ref, lset, t, &histogram.Histogram{Sum: v}, nil) + } else if s.lastFloatHistogramValue != nil { + return a.AppendHistogram(ref, lset, t, nil, &histogram.FloatHistogram{Sum: v}) + } } s.Lock()