8000 Colon is not permitted in label names · yeahnoob/client_python@5e9b0b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5e9b0b1

Browse files
committed
Colon is not permitted in label names
1 parent 45f490b commit 5e9b0b1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

prometheus_client/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from .decorator import decorate
2525

2626
_METRIC_NAME_RE = re.compile(r'^[a-zA-Z_:][a-zA-Z0-9_:]*$')
27-
_METRIC_LABEL_NAME_RE = re.compile(r'^[a-zA-Z_:][a-zA-Z0-9_:]*$')
27+
_METRIC_LABEL_NAME_RE = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*$')
2828
_RESERVED_METRIC_LABEL_NAME_RE = re.compile(r'^__.*$')
2929
_INF = float("inf")
3030
_MINUS_INF = float("-inf")

tests/test_core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ def test_invalid_names_raise(self):
299299
self.assertRaises(ValueError, Counter, '', 'help', namespace='&')
300300
self.assertRaises(ValueError, Counter, '', 'help', subsystem='(')
301301
self.assertRaises(ValueError, Counter, 'c', '', labelnames=['^'])
302+
self.assertRaises(ValueError, Counter, 'c', '', labelnames=['a:b'])
302303
self.assertRaises(ValueError, Counter, 'c', '', labelnames=['__reserved'])
303304
self.assertRaises(ValueError, Summary, 'c', '', labelnames=['quantile'])
304305

0 commit comments

Comments
 (0)
0