mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-27 14:39:40 -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
|
||||
tempNhcb convertnhcb.TempHistogram
|
||||
|
||||
lastNativeHistName string
|
||||
}
|
||||
|
||||
func NewNhcbParser(p Parser, keepClassicHistograms bool) Parser {
|
||||
|
@ -111,12 +113,16 @@ func (p *NhcbParser) Next() (Entry, error) {
|
|||
case EntryHistogram:
|
||||
p.bytes, p.ts, p.h, p.fh = p.parser.Histogram()
|
||||
p.metricString = p.parser.Metric(&p.lset)
|
||||
p.lastNativeHistName = p.lset.Get(labels.MetricName)
|
||||
}
|
||||
return et, err
|
||||
}
|
||||
|
||||
func (p *NhcbParser) handleClassicHistogramSeries(lset labels.Labels) bool {
|
||||
mName := lset.Get(labels.MetricName)
|
||||
if convertnhcb.GetHistogramMetricBaseName(mName) == p.lastNativeHistName {
|
||||
return false
|
||||
}
|
||||
switch {
|
||||
case strings.HasSuffix(mName, "_bucket") && lset.Has(labels.BucketLabel):
|
||||
le, err := strconv.ParseFloat(lset.Get(labels.BucketLabel), 64)
|
||||
|
|
Loading…
Reference in a new issue