Support regular expression in labelFilter (#5174)

Co-authored-by: 吴晟 Wu Sheng <wu.sheng@foxmail.com>
This commit is contained in:
Gao Hongtao 2020-07-27 10:45:41 +08:00 committed by GitHub
parent fea685d7cd
commit a49ce988b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -118,7 +118,8 @@ public class PrometheusMetricConverter {
return true;
}
return rule._3.getLabelFilter().stream()
.allMatch(matchRule -> matchRule.getOptions().contains(metric.getLabels().get(matchRule.getKey())));
.allMatch(matchRule -> matchRule.getOptions().stream()
.anyMatch(metric.getLabels().get(matchRule.getKey())::matches));
})
.map(rule -> Tuple.of(rule._1, rule._2, rule._3, metric))
)