Skip to content

Commit

Permalink
Allow labelmap action
Browse files Browse the repository at this point in the history
  • Loading branch information
maddyblue committed Sep 21, 2015
1 parent cf12e89 commit 0e99fa6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 5 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ var expectedConf = &Config{
Separator: ";",
Action: RelabelKeep,
},
{
Regex: MustNewRegexp("1"),
Separator: ";",
Action: RelabelLabelMap,
},
},
MetricRelabelConfigs: []*RelabelConfig{
{
Expand Down
2 changes: 2 additions & 0 deletions config/testdata/conf.good.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ scrape_configs:
- source_labels: [__tmp_hash]
regex: 1
action: keep
- action: labelmap
regex: 1

metric_relabel_configs:
- source_labels: [__name__]
Expand Down

0 comments on commit 0e99fa6

Please sign in to comment.