mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-14 09:34:05 -08:00
skip nhcb conversion if there is native histogram of same name
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
This commit is contained in:
parent
0e5072b873
commit
cbd5488cd3
|
@ -45,6 +45,8 @@ type NhcbParser struct {
|
||||||
|
|
||||||
lsetNhcb labels.Labels
|
lsetNhcb labels.Labels
|
||||||
tempNhcb convertnhcb.TempHistogram
|
tempNhcb convertnhcb.TempHistogram
|
||||||
|
|
||||||
|
lastNativeHistName string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNhcbParser(p Parser, keepClassicHistograms bool) Parser {
|
func NewNhcbParser(p Parser, keepClassicHistograms bool) Parser {
|
||||||
|
@ -111,12 +113,16 @@ func (p *NhcbParser) Next() (Entry, error) {
|
||||||
case EntryHistogram:
|
case EntryHistogram:
|
||||||
p.bytes, p.ts, p.h, p.fh = p.parser.Histogram()
|
p.bytes, p.ts, p.h, p.fh = p.parser.Histogram()
|
||||||
p.metricString = p.parser.Metric(&p.lset)
|
p.metricString = p.parser.Metric(&p.lset)
|
||||||
|
p.lastNativeHistName = p.lset.Get(labels.MetricName)
|
||||||
}
|
}
|
||||||
return et, err
|
return et, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *NhcbParser) handleClassicHistogramSeries(lset labels.Labels) bool {
|
func (p *NhcbParser) handleClassicHistogramSeries(lset labels.Labels) bool {
|
||||||
mName := lset.Get(labels.MetricName)
|
mName := lset.Get(labels.MetricName)
|
||||||
|
if convertnhcb.GetHistogramMetricBaseName(mName) == p.lastNativeHistName {
|
||||||
|
return false
|
||||||
|
}
|
||||||
switch {
|
switch {
|
||||||
case strings.HasSuffix(mName, "_bucket") && lset.Has(labels.BucketLabel):
|
case strings.HasSuffix(mName, "_bucket") && lset.Has(labels.BucketLabel):
|
||||||
le, err := strconv.ParseFloat(lset.Get(labels.BucketLabel), 64)
|
le, err := strconv.ParseFloat(lset.Get(labels.BucketLabel), 64)
|
||||||
|
|
Loading…
Reference in a new issue