diff --git a/config/config.go b/config/config.go index 2a9918712..61775f6e7 100644 --- a/config/config.go +++ b/config/config.go @@ -1015,10 +1015,10 @@ func (c *RelabelConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { if (c.Action == RelabelReplace || c.Action == RelabelHashMod) && c.TargetLabel == "" { return fmt.Errorf("relabel configuration for %s action requires 'target_label' value", c.Action) } - if c.Action == RelabelReplace && !relabelTarget.Match([]byte(c.TargetLabel)) { + if c.Action == RelabelReplace && !relabelTarget.MatchString(c.TargetLabel) { return fmt.Errorf("%q is invalid 'target_label' for %s action", c.TargetLabel, c.Action) } - if c.Action == RelabelHashMod && !model.LabelNameRE.Match([]byte(c.TargetLabel)) { + if c.Action == RelabelHashMod && !model.LabelName(c.TargetLabel).IsValid() { return fmt.Errorf("%q is invalid 'target_label' for %s action", c.TargetLabel, c.Action) } return nil