mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
fix: cover edgecase of gauge_created
in CreatedTimestamp()
Signed-off-by: Manik Rana <manikrana54@gmail.com>
This commit is contained in:
parent
13586246bc
commit
84bc9d6c3f
|
@ -246,7 +246,6 @@ loop:
|
|||
continue
|
||||
}
|
||||
|
||||
// edge case: if gauge_created of unknown type -> skip parsing
|
||||
newLbs = newLbs.DropMetricName()
|
||||
switch p.mtype {
|
||||
case model.MetricTypeCounter:
|
||||
|
@ -620,10 +619,16 @@ func (p *OpenMetricsParser) parseMetricSuffix(t token) (Entry, error) {
|
|||
var newLbs labels.Labels
|
||||
p.Metric(&newLbs)
|
||||
name := newLbs.Get(model.MetricNameLabel)
|
||||
if strings.HasSuffix(name, "_created") && p.skipCT {
|
||||
return p.Next()
|
||||
switch p.mtype {
|
||||
case model.MetricTypeCounter, model.MetricTypeSummary, model.MetricTypeHistogram:
|
||||
if strings.HasSuffix(name, "_created") && p.skipCT {
|
||||
return p.Next()
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
return EntrySeries, nil
|
||||
|
||||
}
|
||||
|
||||
func (p *OpenMetricsParser) getFloatValue(t token, after string) (float64, error) {
|
||||
|
|
|
@ -79,7 +79,9 @@ baz_bucket{le="0.0"} 0
|
|||
baz_bucket{le="+Inf"} 17
|
||||
baz_count 17
|
||||
baz_sum 324789.3
|
||||
baz_created 1520430000`
|
||||
baz_created 1520430000
|
||||
# TYPE fizz_created gauge
|
||||
fizz_created 17.0`
|
||||
|
||||
input += "\n# HELP metric foo\x00bar"
|
||||
input += "\nnull_byte_metric{a=\"abc\x00\"} 1"
|
||||
|
@ -294,6 +296,13 @@ baz_created 1520430000`
|
|||
v: 324789.3,
|
||||
lset: labels.FromStrings("__name__", "baz_sum"),
|
||||
ct: int64p(1520430000),
|
||||
}, {
|
||||
m: "fizz_created",
|
||||
typ: model.MetricTypeGauge,
|
||||
}, {
|
||||
m: `fizz_created`,
|
||||
v: 17,
|
||||
lset: labels.FromStrings("__name__", "fizz_created"),
|
||||
}, {
|
||||
m: "metric",
|
||||
help: "foo\x00bar",
|
||||
|
|
Loading…
Reference in a new issue