diff --git a/config/config.go b/config/config.go index 3b3d7f613..eef034e17 100644 --- a/config/config.go +++ b/config/config.go @@ -687,7 +687,7 @@ func (a *RelabelAction) UnmarshalYAML(unmarshal func(interface{}) error) error { return err } switch act := RelabelAction(strings.ToLower(s)); act { - case RelabelReplace, RelabelKeep, RelabelDrop, RelabelHashMod: + case RelabelReplace, RelabelKeep, RelabelDrop, RelabelHashMod, RelabelLabelMap: *a = act return nil } diff --git a/config/config_test.go b/config/config_test.go index 8e7ad834d..a8571d54d 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -143,6 +143,11 @@ var expectedConf = &Config{ Separator: ";", Action: RelabelKeep, }, + { + Regex: MustNewRegexp("1"), + Separator: ";", + Action: RelabelLabelMap, + }, }, MetricRelabelConfigs: []*RelabelConfig{ { diff --git a/config/testdata/conf.good.yml b/config/testdata/conf.good.yml index 13493cc87..6b3745083 100644 --- a/config/testdata/conf.good.yml +++ b/config/testdata/conf.good.yml @@ -80,6 +80,8 @@ scrape_configs: - source_labels: [__tmp_hash] regex: 1 action: keep + - action: labelmap + regex: 1 metric_relabel_configs: - source_labels: [__name__]