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