mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Fix protobuf parsing of quantile-less summaries (#9277)
Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
eeace6bcab
commit
4a85354a2c
|
@ -96,6 +96,10 @@ func (p *ProtobufParser) Series() ([]byte, *int64, float64) {
|
|||
v = float64(s.GetSampleCount())
|
||||
case -1:
|
||||
v = s.GetSampleSum()
|
||||
// Need to detect a summaries without quantile here.
|
||||
if len(s.GetQuantile()) == 0 {
|
||||
p.fieldsDone = true
|
||||
}
|
||||
default:
|
||||
v = s.GetQuantile()[p.fieldPos].GetValue()
|
||||
}
|
||||
|
|
|
@ -227,6 +227,16 @@ metric: <
|
|||
>
|
||||
>
|
||||
>
|
||||
`,
|
||||
`name: "without_quantiles"
|
||||
help: "A summary without quantiles."
|
||||
type: SUMMARY
|
||||
metric: <
|
||||
summary: <
|
||||
sample_count: 42
|
||||
sample_sum: 1.234
|
||||
>
|
||||
>
|
||||
`,
|
||||
}
|
||||
|
||||
|
@ -458,6 +468,28 @@ metric: <
|
|||
"service", "exponential",
|
||||
),
|
||||
},
|
||||
{
|
||||
m: "without_quantiles",
|
||||
help: "A summary without quantiles.",
|
||||
},
|
||||
{
|
||||
m: "without_quantiles",
|
||||
typ: MetricTypeSummary,
|
||||
},
|
||||
{
|
||||
m: "without_quantiles_count",
|
||||
v: 42,
|
||||
lset: labels.FromStrings(
|
||||
"__name__", "without_quantiles_count",
|
||||
),
|
||||
},
|
||||
{
|
||||
m: "without_quantiles_sum",
|
||||
v: 1.234,
|
||||
lset: labels.FromStrings(
|
||||
"__name__", "without_quantiles_sum",
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
p := NewProtobufParser(inputBuf.Bytes())
|
||||
|
|
Loading…
Reference in a new issue