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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// edge case: if gauge_created of unknown type -> skip parsing
|
|
||||||
newLbs = newLbs.DropMetricName()
|
newLbs = newLbs.DropMetricName()
|
||||||
switch p.mtype {
|
switch p.mtype {
|
||||||
case model.MetricTypeCounter:
|
case model.MetricTypeCounter:
|
||||||
|
@ -620,10 +619,16 @@ func (p *OpenMetricsParser) parseMetricSuffix(t token) (Entry, error) {
|
||||||
var newLbs labels.Labels
|
var newLbs labels.Labels
|
||||||
p.Metric(&newLbs)
|
p.Metric(&newLbs)
|
||||||
name := newLbs.Get(model.MetricNameLabel)
|
name := newLbs.Get(model.MetricNameLabel)
|
||||||
|
switch p.mtype {
|
||||||
|
case model.MetricTypeCounter, model.MetricTypeSummary, model.MetricTypeHistogram:
|
||||||
if strings.HasSuffix(name, "_created") && p.skipCT {
|
if strings.HasSuffix(name, "_created") && p.skipCT {
|
||||||
return p.Next()
|
return p.Next()
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
return EntrySeries, nil
|
return EntrySeries, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *OpenMetricsParser) getFloatValue(t token, after string) (float64, error) {
|
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_bucket{le="+Inf"} 17
|
||||||
baz_count 17
|
baz_count 17
|
||||||
baz_sum 324789.3
|
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 += "\n# HELP metric foo\x00bar"
|
||||||
input += "\nnull_byte_metric{a=\"abc\x00\"} 1"
|
input += "\nnull_byte_metric{a=\"abc\x00\"} 1"
|
||||||
|
@ -294,6 +296,13 @@ baz_created 1520430000`
|
||||||
v: 324789.3,
|
v: 324789.3,
|
||||||
lset: labels.FromStrings("__name__", "baz_sum"),
|
lset: labels.FromStrings("__name__", "baz_sum"),
|
||||||
ct: int64p(1520430000),
|
ct: int64p(1520430000),
|
||||||
|
}, {
|
||||||
|
m: "fizz_created",
|
||||||
|
typ: model.MetricTypeGauge,
|
||||||
|
}, {
|
||||||
|
m: `fizz_created`,
|
||||||
|
v: 17,
|
||||||
|
lset: labels.FromStrings("__name__", "fizz_created"),
|
||||||
}, {
|
}, {
|
||||||
m: "metric",
|
m: "metric",
|
||||||
help: "foo\x00bar",
|
help: "foo\x00bar",
|
||||||
|
|
Loading…
Reference in a new issue