mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promrelabel: properly apply ^
and $
anchors to regex
value in Prometheus relabeling rules
This commit is contained in:
parent
a586b8b6d4
commit
aad38c8283
1 changed files with 1 additions and 1 deletions
|
@ -63,7 +63,7 @@ func parseRelabelConfig(dst []ParsedRelabelConfig, rc *RelabelConfig) ([]ParsedR
|
||||||
if rc.Regex != nil {
|
if rc.Regex != nil {
|
||||||
regex := *rc.Regex
|
regex := *rc.Regex
|
||||||
if rc.Action != "replace_all" && rc.Action != "labelmap_all" {
|
if rc.Action != "replace_all" && rc.Action != "labelmap_all" {
|
||||||
regex = "^" + *rc.Regex + "$"
|
regex = "^(?:" + *rc.Regex + ")$"
|
||||||
}
|
}
|
||||||
re, err := regexp.Compile(regex)
|
re, err := regexp.Compile(regex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue