parent
db4df06414
commit
458550560c
|
@ -409,7 +409,13 @@ type RelabelConfig struct {
|
|||
func (c *RelabelConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
*c = DefaultRelabelConfig
|
||||
type plain RelabelConfig
|
||||
return unmarshal((*plain)(c))
|
||||
if err := unmarshal((*plain)(c)); err != nil {
|
||||
return err
|
||||
}
|
||||
if c.Regex == nil {
|
||||
return fmt.Errorf("relabel configuration requires a regular expression")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Regexp encapsulates a regexp.Regexp and makes it YAML marshallable.
|
||||
|
|
|
@ -164,6 +164,9 @@ var expectedErrors = []struct {
|
|||
}, {
|
||||
filename: "regex.bad.yml",
|
||||
errMsg: "error parsing regexp",
|
||||
}, {
|
||||
filename: "regex_missing.bad.yml",
|
||||
errMsg: "relabel configuration requires a regular expression",
|
||||
}, {
|
||||
filename: "rules.bad.yml",
|
||||
errMsg: "invalid rule file path",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
scrape_configs:
|
||||
- job_name: prometheus
|
||||
relabel_configs:
|
||||
- source_labels: ['blub']
|
Loading…
Reference in New Issue