mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Log when created timestamps are ignored
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
This commit is contained in:
parent
70be156e4e
commit
5cefd915ad
|
@ -1568,7 +1568,12 @@ loop:
|
|||
if ctMs := (ct.Seconds * 1000) + int64(ct.Nanos/1_000_000); ctMs < t {
|
||||
ref, err = app.AppendCreatedTimestamp(ref, lset, ctMs)
|
||||
if err != nil {
|
||||
level.Debug(sl.l).Log("msg", "created timestamp not ingested", "reason", err)
|
||||
if errors.Is(err, storage.ErrCreatedTimestampOutOfOrder) {
|
||||
level.Debug(sl.l).Log("msg", storage.ErrCreatedTimestampOutOfOrder)
|
||||
} else {
|
||||
level.Debug(sl.l).Log("msg", "Unexpected error", "series", string(met), "err", err)
|
||||
break loop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ var (
|
|||
ErrExemplarLabelLength = fmt.Errorf("label length for exemplar exceeds maximum of %d UTF-8 characters", exemplar.ExemplarMaxLabelSetLength)
|
||||
ErrExemplarsDisabled = fmt.Errorf("exemplar storage is disabled or max exemplars is less than or equal to 0")
|
||||
ErrNativeHistogramsDisabled = fmt.Errorf("native histograms are disabled")
|
||||
ErrCreatedTimestampOutOfOrder = fmt.Errorf("created timestamp out of order, ignoring")
|
||||
)
|
||||
|
||||
// SeriesRef is a generic series reference. In prometheus it is either a
|
||||
|
@ -304,8 +305,7 @@ type CreatedTimestampAppender interface {
|
|||
// Appending created timestamps is optional, that is because appending sythetic zeros
|
||||
// should only happen if created timestamp respects the order of the samples, i.e. is not out-of-order.
|
||||
//
|
||||
// When AppendCreatedTimestamp decides to not append a sample, it should return a warning that can be
|
||||
// logged by the caller.
|
||||
// When AppendCreatedTimestamp decides to not append a sample, it should return an error that can be treated by the caller.
|
||||
AppendCreatedTimestamp(ref SeriesRef, l labels.Labels, t int64) (SeriesRef, error)
|
||||
}
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ func (a *headAppender) AppendCreatedTimestamp(ref storage.SeriesRef, lset labels
|
|||
}
|
||||
|
||||
if isOOO {
|
||||
return storage.SeriesRef(s.ref), nil
|
||||
return storage.SeriesRef(s.ref), storage.ErrCreatedTimestampOutOfOrder
|
||||
}
|
||||
|
||||
if t > a.maxt {
|
||||
|
|
Loading…
Reference in a new issue