Catch illegal label names for summaries in histograms.

This commit is contained in:
beorn7 2015-02-19 02:01:06 +01:00
parent 6958242277
commit 4c4f51d546
1 changed files with 11 additions and 0 deletions

View File

@ -163,6 +163,17 @@ func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary {
panic(errInconsistentCardinality)
}
for _, n := range desc.variableLabels {
if n == "quantile" {
panic("'quantile' is not allowed as label name in summaries")
}
}
for _, lp := range desc.constLabelPairs {
if lp.GetName() == "quantile" {
panic("'quantile' is not allowed as label name in summaries")
}
}
if len(opts.Objectives) == 0 {
opts.Objectives = DefObjectives
}