mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 14:09:41 -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 {
|
||||
p.justInsertedNHCB = false
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +169,9 @@ func (p *NHCBParser) Next() (Entry, error) {
|
|||
p.entry = et
|
||||
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 et, err
|
||||
|
@ -206,7 +210,7 @@ func (p *NHCBParser) compareLabels() bool {
|
|||
return true
|
||||
}
|
||||
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)
|
||||
if lastHash != nextHash {
|
||||
// Different label values.
|
||||
|
|
Loading…
Reference in a new issue