From 0e99fa6c46d92089ee8f93192234cef3aa345157 Mon Sep 17 00:00:00 2001 From: Matt Jibson Date: Mon, 21 Sep 2015 15:41:19 -0400 Subject: [PATCH] Allow labelmap action --- config/config.go | 2 +- config/config_test.go | 5 +++++ config/testdata/conf.good.yml | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) 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__]