mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-27 06:29:42 -08:00
Fix case of keeping classic series
Make it more obvious that the code in if had side effect. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
parent
8dfa733596
commit
530e9514b7
|
@ -143,7 +143,9 @@ func (p *NHCBParser) Next() (Entry, error) {
|
||||||
if p.justInsertedNHCB {
|
if p.justInsertedNHCB {
|
||||||
p.justInsertedNHCB = false
|
p.justInsertedNHCB = false
|
||||||
if p.entry == EntrySeries {
|
if p.entry == EntrySeries {
|
||||||
if !p.keepClassicHistograms && p.handleClassicHistogramSeries(p.lset) {
|
isNHCB := p.handleClassicHistogramSeries(p.lset)
|
||||||
|
if isNHCB && !p.keepClassicHistograms {
|
||||||
|
// Do not return the classic histogram series if it was converted to NHCB and we are not keeping classic histograms.
|
||||||
return p.Next()
|
return p.Next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +169,9 @@ func (p *NHCBParser) Next() (Entry, error) {
|
||||||
p.entry = et
|
p.entry = et
|
||||||
return EntryHistogram, nil
|
return EntryHistogram, nil
|
||||||
}
|
}
|
||||||
if !p.keepClassicHistograms && p.handleClassicHistogramSeries(p.lset) {
|
isNHCB := p.handleClassicHistogramSeries(p.lset)
|
||||||
|
if isNHCB && !p.keepClassicHistograms {
|
||||||
|
// Do not return the classic histogram series if it was converted to NHCB and we are not keeping classic histograms.
|
||||||
return p.Next()
|
return p.Next()
|
||||||
}
|
}
|
||||||
return et, err
|
return et, err
|
||||||
|
@ -206,7 +210,7 @@ func (p *NHCBParser) compareLabels() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
var buf []byte
|
var buf []byte
|
||||||
lastHash, _ := p.lastBaseHistLabels.HashWithoutLabels(buf, labels.BucketLabel)
|
lastHash, _ := p.lastBaseHistLabels.HashWithoutLabels(buf) // We removed the bucket label in storeBaseLabels.
|
||||||
nextHash, _ := p.lset.HashWithoutLabels(buf, labels.BucketLabel)
|
nextHash, _ := p.lset.HashWithoutLabels(buf, labels.BucketLabel)
|
||||||
if lastHash != nextHash {
|
if lastHash != nextHash {
|
||||||
// Different label values.
|
// Different label values.
|
||||||
|
|
Loading…
Reference in a new issue