From 4c4f51d546c117c007e31b7c486c634b54ef16db Mon Sep 17 00:00:00 2001 From: beorn7 Date: Thu, 19 Feb 2015 02:01:06 +0100 Subject: [PATCH] Catch illegal label names for summaries in histograms. --- prometheus/summary.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/prometheus/summary.go b/prometheus/summary.go index 0626d08..2d4bc55 100644 --- a/prometheus/summary.go +++ b/prometheus/summary.go @@ -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 }