Addressed Krajo's comment.

Signed-off-by: bwplotka <bwplotka@gmail.com>
This commit is contained in:
bwplotka 2025-01-16 13:15:56 +00:00
parent 9385f31147
commit af928a1ba4

View file

@ -1694,13 +1694,13 @@ loop:
if sl.cache.getDropped(met) { if sl.cache.getDropped(met) {
continue continue
} }
ce, ok, seriesAlreadyScraped := sl.cache.get(met) ce, seriesCached, seriesAlreadyScraped := sl.cache.get(met)
var ( var (
ref storage.SeriesRef ref storage.SeriesRef
hash uint64 hash uint64
) )
if ok { if seriesCached {
ref = ce.ref ref = ce.ref
lset = ce.lset lset = ce.lset
hash = ce.hash hash = ce.hash
@ -1781,7 +1781,7 @@ loop:
break loop break loop
} }
if !ok { if !seriesCached {
if parsedTimestamp == nil || sl.trackTimestampsStaleness { if parsedTimestamp == nil || sl.trackTimestampsStaleness {
// Bypass staleness logic if there is an explicit timestamp. // Bypass staleness logic if there is an explicit timestamp.
sl.cache.trackStaleness(hash, lset) sl.cache.trackStaleness(hash, lset)
@ -1841,7 +1841,7 @@ loop:
if sl.appendMetadataToWAL && lastMeta != nil { if sl.appendMetadataToWAL && lastMeta != nil {
// Is it new series OR did metadata change for this family? // Is it new series OR did metadata change for this family?
if !ok || lastMeta.lastIterChange == sl.cache.iter { if !seriesCached || lastMeta.lastIterChange == sl.cache.iter {
// In majority cases we can trust that the current series/histogram is matching the lastMeta and lastMFName. // In majority cases we can trust that the current series/histogram is matching the lastMeta and lastMFName.
// However, optional TYPE etc metadata and broken OM text can break this, detect those cases here. // However, optional TYPE etc metadata and broken OM text can break this, detect those cases here.
// TODO(bwplotka): Consider moving this to parser as many parser users end up doing this (e.g. CT and NHCB parsing). // TODO(bwplotka): Consider moving this to parser as many parser users end up doing this (e.g. CT and NHCB parsing).