Merge pull request #14042 from aknuds1/arve/wlog-histograms

tsdb/wlog: Only treat unknown record types as failure
This commit is contained in:
Arve Knudsen 2024-08-16 12:00:49 +02:00 committed by GitHub
commit 66388f706a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 8 deletions

View file

@ -3,6 +3,7 @@
## unreleased ## unreleased
* [FEATURE] OTLP receiver: Add new option `otlp.promote_resource_attributes`, for any OTel resource attributes that should be promoted to metric labels. #14200 * [FEATURE] OTLP receiver: Add new option `otlp.promote_resource_attributes`, for any OTel resource attributes that should be promoted to metric labels. #14200
* [BUGFIX] tsdb/wlog.Watcher.readSegmentForGC: Only count unknown record types against record_decode_failures_total metric. #14042
## 2.54.0-rc.1 / 2024-08-05 ## 2.54.0-rc.1 / 2024-08-05

View file

@ -572,6 +572,7 @@ func (w *Watcher) readSegment(r *LiveReader, segmentNum int, tail bool) error {
w.writer.AppendHistograms(histogramsToSend) w.writer.AppendHistograms(histogramsToSend)
histogramsToSend = histogramsToSend[:0] histogramsToSend = histogramsToSend[:0]
} }
case record.FloatHistogramSamples: case record.FloatHistogramSamples:
// Skip if experimental "histograms over remote write" is not enabled. // Skip if experimental "histograms over remote write" is not enabled.
if !w.sendHistograms { if !w.sendHistograms {
@ -610,11 +611,13 @@ func (w *Watcher) readSegment(r *LiveReader, segmentNum int, tail bool) error {
return err return err
} }
w.writer.StoreMetadata(meta) w.writer.StoreMetadata(meta)
case record.Tombstones:
default: case record.Unknown:
// Could be corruption, or reading from a WAL from a newer Prometheus. // Could be corruption, or reading from a WAL from a newer Prometheus.
w.recordDecodeFailsMetric.Inc() w.recordDecodeFailsMetric.Inc()
default:
// We're not interested in other types of records.
} }
} }
if err := r.Err(); err != nil { if err := r.Err(); err != nil {
@ -643,14 +646,12 @@ func (w *Watcher) readSegmentForGC(r *LiveReader, segmentNum int, _ bool) error
} }
w.writer.UpdateSeriesSegment(series, segmentNum) w.writer.UpdateSeriesSegment(series, segmentNum)
// Ignore these; we're only interested in series. case record.Unknown:
case record.Samples:
case record.Exemplars:
case record.Tombstones:
default:
// Could be corruption, or reading from a WAL from a newer Prometheus. // Could be corruption, or reading from a WAL from a newer Prometheus.
w.recordDecodeFailsMetric.Inc() w.recordDecodeFailsMetric.Inc()
default:
// We're only interested in series.
} }
} }
if err := r.Err(); err != nil { if err := r.Err(); err != nil {