Skip to content

Commit 242b076

Browse files
committed
Add tmp prometheus.AllowReservedLabels global.
Signed-off-by: bwplotka <[email protected]>
1 parent 331dfab commit 242b076

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

prometheus/labels.go

+8
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ func validateLabelValues(vals []string, expectedNumberOfValues int) error {
183183
return nil
184184
}
185185

186+
// AllowReservedLabels relaxes the check for labels starting with __
187+
// TODO(bwplotka): Only for demo, if needed long term, it has to be part of desc option,
188+
// not global.
189+
var AllowReservedLabels bool
190+
186191
func checkLabelName(l string) bool {
192+
if AllowReservedLabels {
193+
return model.LabelName(l).IsValid()
194+
}
187195
return model.LabelName(l).IsValid() && !strings.HasPrefix(l, reservedLabelPrefix)
188196
}

0 commit comments

Comments
 (0)