Skip to content

Commit 91bea3d

Browse files
author
Conor Broderick
authored
Merge pull request prometheus#932 from paystee/fix-label-matching
Fix label matching in routing tree editor
2 parents a3bfe8c + 2f78f74 commit 91bea3d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

static/routing-tree.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ function matchLabels(matchers, labelSet) {
115115

116116
// Compare single matcher to labelSet
117117
function matchLabel(matcher, labelSet) {
118-
var v = labelSet[matcher.name];
118+
var v = "";
119+
if (matcher.name in labelSet) {
120+
v = labelSet[matcher.name];
121+
}
119122

120123
if (matcher.isRegex) {
121124
return matcher.value.test(v)
@@ -156,7 +159,7 @@ function massage(root) {
156159
for (var key in root.match_re) {
157160
var o = {};
158161
o.isRegex = true;
159-
o.value = new RegExp(root.match_re[key]);
162+
o.value = new RegExp("^(?:" + root.match_re[key] + ")$");
160163
o.name = key;
161164
matchers.push(o);
162165
}

0 commit comments

Comments
 (0)