|
|
|
@ -835,11 +835,18 @@ func (a *headAppender) Commit() (err error) {
|
|
|
|
|
defer a.head.iso.closeAppend(a.appendID)
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
samplesAppended = len(a.samples)
|
|
|
|
|
oooAccepted int // number of samples out of order but accepted: with ooo enabled and within time window
|
|
|
|
|
oooRejected int // number of samples rejected due to: out of order but OOO support disabled.
|
|
|
|
|
tooOldRejected int // number of samples rejected due to: that are out of order but too old (OOO support enabled, but outside time window)
|
|
|
|
|
oobRejected int // number of samples rejected due to: out of bounds: with t < minValidTime (OOO support disabled)
|
|
|
|
|
floatsAppended = len(a.samples)
|
|
|
|
|
histogramsAppended = len(a.histograms) + len(a.floatHistograms)
|
|
|
|
|
// number of samples out of order but accepted: with ooo enabled and within time window
|
|
|
|
|
floatOOOAccepted int
|
|
|
|
|
// number of samples rejected due to: out of order but OOO support disabled.
|
|
|
|
|
floatOOORejected int
|
|
|
|
|
histoOOORejected int
|
|
|
|
|
// number of samples rejected due to: that are out of order but too old (OOO support enabled, but outside time window)
|
|
|
|
|
floatTooOldRejected int
|
|
|
|
|
// number of samples rejected due to: out of bounds: with t < minValidTime (OOO support disabled)
|
|
|
|
|
floatOOBRejected int
|
|
|
|
|
|
|
|
|
|
inOrderMint int64 = math.MaxInt64
|
|
|
|
|
inOrderMaxt int64 = math.MinInt64
|
|
|
|
|
ooomint int64 = math.MaxInt64
|
|
|
|
@ -902,16 +909,16 @@ func (a *headAppender) Commit() (err error) {
|
|
|
|
|
case err == nil:
|
|
|
|
|
// Do nothing.
|
|
|
|
|
case errors.Is(err, storage.ErrOutOfOrderSample):
|
|
|
|
|
samplesAppended--
|
|
|
|
|
oooRejected++
|
|
|
|
|
floatsAppended--
|
|
|
|
|
floatOOORejected++
|
|
|
|
|
case errors.Is(err, storage.ErrOutOfBounds):
|
|
|
|
|
samplesAppended--
|
|
|
|
|
oobRejected++
|
|
|
|
|
floatsAppended--
|
|
|
|
|
floatOOBRejected++
|
|
|
|
|
case errors.Is(err, storage.ErrTooOldSample):
|
|
|
|
|
samplesAppended--
|
|
|
|
|
tooOldRejected++
|
|
|
|
|
floatsAppended--
|
|
|
|
|
floatTooOldRejected++
|
|
|
|
|
default:
|
|
|
|
|
samplesAppended--
|
|
|
|
|
floatsAppended--
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ok, chunkCreated bool
|
|
|
|
@ -949,13 +956,13 @@ func (a *headAppender) Commit() (err error) {
|
|
|
|
|
if s.T > ooomaxt {
|
|
|
|
|
ooomaxt = s.T
|
|
|
|
|
}
|
|
|
|
|
oooAccepted++
|
|
|
|
|
floatOOOAccepted++
|
|
|
|
|
} else {
|
|
|
|
|
// Sample is an exact duplicate of the last sample.
|
|
|
|
|
// NOTE: We can only detect updates if they clash with a sample in the OOOHeadChunk,
|
|
|
|
|
// not with samples in already flushed OOO chunks.
|
|
|
|
|
// TODO(codesome): Add error reporting? It depends on addressing https://github.com/prometheus/prometheus/discussions/10305.
|
|
|
|
|
samplesAppended--
|
|
|
|
|
floatsAppended--
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
ok, chunkCreated = series.append(s.T, s.V, a.appendID, appendChunkOpts)
|
|
|
|
@ -968,7 +975,7 @@ func (a *headAppender) Commit() (err error) {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// The sample is an exact duplicate, and should be silently dropped.
|
|
|
|
|
samplesAppended--
|
|
|
|
|
floatsAppended--
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -982,8 +989,6 @@ func (a *headAppender) Commit() (err error) {
|
|
|
|
|
series.Unlock()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
histogramsTotal := len(a.histograms)
|
|
|
|
|
histoOOORejected := 0
|
|
|
|
|
for i, s := range a.histograms {
|
|
|
|
|
series = a.histogramSeries[i]
|
|
|
|
|
series.Lock()
|
|
|
|
@ -1000,7 +1005,7 @@ func (a *headAppender) Commit() (err error) {
|
|
|
|
|
inOrderMaxt = s.T
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
histogramsTotal--
|
|
|
|
|
histogramsAppended--
|
|
|
|
|
histoOOORejected++
|
|
|
|
|
}
|
|
|
|
|
if chunkCreated {
|
|
|
|
@ -1009,7 +1014,6 @@ func (a *headAppender) Commit() (err error) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
histogramsTotal += len(a.floatHistograms)
|
|
|
|
|
for i, s := range a.floatHistograms {
|
|
|
|
|
series = a.floatHistogramSeries[i]
|
|
|
|
|
series.Lock()
|
|
|
|
@ -1026,7 +1030,7 @@ func (a *headAppender) Commit() (err error) {
|
|
|
|
|
inOrderMaxt = s.T
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
histogramsTotal--
|
|
|
|
|
histogramsAppended--
|
|
|
|
|
histoOOORejected++
|
|
|
|
|
}
|
|
|
|
|
if chunkCreated {
|
|
|
|
@ -1042,13 +1046,13 @@ func (a *headAppender) Commit() (err error) {
|
|
|
|
|
series.Unlock()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a.head.metrics.outOfOrderSamples.WithLabelValues(sampleMetricTypeFloat).Add(float64(oooRejected))
|
|
|
|
|
a.head.metrics.outOfOrderSamples.WithLabelValues(sampleMetricTypeFloat).Add(float64(floatOOORejected))
|
|
|
|
|
a.head.metrics.outOfOrderSamples.WithLabelValues(sampleMetricTypeHistogram).Add(float64(histoOOORejected))
|
|
|
|
|
a.head.metrics.outOfBoundSamples.WithLabelValues(sampleMetricTypeFloat).Add(float64(oobRejected))
|
|
|
|
|
a.head.metrics.tooOldSamples.WithLabelValues(sampleMetricTypeFloat).Add(float64(tooOldRejected))
|
|
|
|
|
a.head.metrics.samplesAppended.WithLabelValues(sampleMetricTypeFloat).Add(float64(samplesAppended))
|
|
|
|
|
a.head.metrics.samplesAppended.WithLabelValues(sampleMetricTypeHistogram).Add(float64(histogramsTotal))
|
|
|
|
|
a.head.metrics.outOfOrderSamplesAppended.Add(float64(oooAccepted))
|
|
|
|
|
a.head.metrics.outOfBoundSamples.WithLabelValues(sampleMetricTypeFloat).Add(float64(floatOOBRejected))
|
|
|
|
|
a.head.metrics.tooOldSamples.WithLabelValues(sampleMetricTypeFloat).Add(float64(floatTooOldRejected))
|
|
|
|
|
a.head.metrics.samplesAppended.WithLabelValues(sampleMetricTypeFloat).Add(float64(floatsAppended))
|
|
|
|
|
a.head.metrics.samplesAppended.WithLabelValues(sampleMetricTypeHistogram).Add(float64(histogramsAppended))
|
|
|
|
|
a.head.metrics.outOfOrderSamplesAppended.WithLabelValues(sampleMetricTypeFloat).Add(float64(floatOOOAccepted))
|
|
|
|
|
a.head.updateMinMaxTime(inOrderMint, inOrderMaxt)
|
|
|
|
|
a.head.updateMinOOOMaxOOOTime(ooomint, ooomaxt)
|
|
|
|
|
|
|
|
|
|