Skip to content

Commit 4c4f51d

Browse files
author
beorn7
committed
Catch illegal label names for summaries in histograms.
1 parent 6958242 commit 4c4f51d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

prometheus/summary.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,17 @@ func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary {
163163
panic(errInconsistentCardinality)
164164
}
165165

166+
for _, n := range desc.variableLabels {
167+
if n == "quantile" {
168+
panic("'quantile' is not allowed as label name in summaries")
169+
}
170+
}
171+
for _, lp := range desc.constLabelPairs {
172+
if lp.GetName() == "quantile" {
173+
panic("'quantile' is not allowed as label name in summaries")
174+
}
175+
}
176+
166177
if len(opts.Objectives) == 0 {
167178
opts.Objectives = DefObjectives
168179
}

0 commit comments

Comments
 (0)