From aabf4a419bfbc95112b437b7ba0be426c83d8a09 Mon Sep 17 00:00:00 2001 From: Matti Savolainen Date: Wed, 19 Oct 2016 16:30:52 +0300 Subject: [PATCH] use LabelNam.IsValid() instead of LabelNameRE and MatchString instead of Match --- config/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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