mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19:40 -08:00
Log count of dupliates/out of order samples as warnings.
Keep log of each sample as debug log.
This commit is contained in:
parent
8b9d3e7547
commit
d657d722dc
|
@ -609,6 +609,8 @@ func (sl *scrapeLoop) append(b []byte, ts time.Time) (total, added int, err erro
|
||||||
p = textparse.New(b)
|
p = textparse.New(b)
|
||||||
defTime = timestamp.FromTime(ts)
|
defTime = timestamp.FromTime(ts)
|
||||||
samplesScraped = map[string]labels.Labels{}
|
samplesScraped = map[string]labels.Labels{}
|
||||||
|
numOutOfOrder = 0
|
||||||
|
numDuplicates = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
|
@ -632,10 +634,12 @@ loop:
|
||||||
case errSeriesDropped:
|
case errSeriesDropped:
|
||||||
continue
|
continue
|
||||||
case storage.ErrOutOfOrderSample:
|
case storage.ErrOutOfOrderSample:
|
||||||
log.With("timeseries", string(met)).Warn("Out of order sample")
|
log.With("timeseries", string(met)).Debug("Out of order sample")
|
||||||
|
numOutOfOrder += 1
|
||||||
continue
|
continue
|
||||||
case storage.ErrDuplicateSampleForTimestamp:
|
case storage.ErrDuplicateSampleForTimestamp:
|
||||||
log.With("timeseries", string(met)).Warn("Duplicate sample for timestamp")
|
numDuplicates += 1
|
||||||
|
log.With("timeseries", string(met)).Debug("Duplicate sample for timestamp")
|
||||||
continue
|
continue
|
||||||
default:
|
default:
|
||||||
break loop
|
break loop
|
||||||
|
@ -654,11 +658,13 @@ loop:
|
||||||
continue
|
continue
|
||||||
case storage.ErrOutOfOrderSample:
|
case storage.ErrOutOfOrderSample:
|
||||||
err = nil
|
err = nil
|
||||||
log.With("timeseries", string(met)).Warn("Out of order sample")
|
log.With("timeseries", string(met)).Debug("Out of order sample")
|
||||||
|
numOutOfOrder += 1
|
||||||
continue
|
continue
|
||||||
case storage.ErrDuplicateSampleForTimestamp:
|
case storage.ErrDuplicateSampleForTimestamp:
|
||||||
err = nil
|
err = nil
|
||||||
log.With("timeseries", string(met)).Warn("Duplicate sample for timestamp")
|
numDuplicates += 1
|
||||||
|
log.With("timeseries", string(met)).Debug("Duplicate sample for timestamp")
|
||||||
continue
|
continue
|
||||||
default:
|
default:
|
||||||
break loop
|
break loop
|
||||||
|
@ -678,6 +684,12 @@ loop:
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = p.Err()
|
err = p.Err()
|
||||||
}
|
}
|
||||||
|
if numOutOfOrder > 0 {
|
||||||
|
log.With("numDropped", numOutOfOrder).Warn("Error on ingesting out-of-order samples")
|
||||||
|
}
|
||||||
|
if numDuplicates > 0 {
|
||||||
|
log.With("numDropped", numDuplicates).Warn("Error on ingesting samples with different value but same timestamp")
|
||||||
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
for metric, lset := range sl.samplesInPreviousScrape {
|
for metric, lset := range sl.samplesInPreviousScrape {
|
||||||
if _, ok := samplesScraped[metric]; !ok {
|
if _, ok := samplesScraped[metric]; !ok {
|
||||||
|
@ -689,8 +701,8 @@ loop:
|
||||||
err = nil
|
err = nil
|
||||||
continue
|
continue
|
||||||
case storage.ErrOutOfOrderSample, storage.ErrDuplicateSampleForTimestamp:
|
case storage.ErrOutOfOrderSample, storage.ErrDuplicateSampleForTimestamp:
|
||||||
// Do not log here, as this is expected if a target goes away and comes back
|
// Do not count these in logging, as this is expected if a target
|
||||||
// again with a new scrape loop.
|
// goes away and comes back again with a new scrape loop.
|
||||||
err = nil
|
err = nil
|
||||||
continue
|
continue
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue