mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Add interpolation to good test config. Fix regex
This commit is contained in:
parent
7a36af1c85
commit
56907ba6e3
|
@ -31,7 +31,7 @@ var (
|
||||||
patFileSDName = regexp.MustCompile(`^[^*]*(\*[^/]*)?\.(json|yml|yaml|JSON|YML|YAML)$`)
|
patFileSDName = regexp.MustCompile(`^[^*]*(\*[^/]*)?\.(json|yml|yaml|JSON|YML|YAML)$`)
|
||||||
patRulePath = regexp.MustCompile(`^[^*]*(\*[^/]*)?$`)
|
patRulePath = regexp.MustCompile(`^[^*]*(\*[^/]*)?$`)
|
||||||
patAuthLine = regexp.MustCompile(`((?:password|bearer_token|secret_key|client_secret):\s+)(".+"|'.+'|[^\s]+)`)
|
patAuthLine = regexp.MustCompile(`((?:password|bearer_token|secret_key|client_secret):\s+)(".+"|'.+'|[^\s]+)`)
|
||||||
relabelTarget = regexp.MustCompile(`^(?:(?:[a-zA-Z_]|\$\{?[\w]+}?)+\w*)+$`)
|
relabelTarget = regexp.MustCompile(`^(?:(?:[a-zA-Z_]|\$\{?[\w]+\}?)+\w*)+$`)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Load parses the YAML input s into a Config.
|
// Load parses the YAML input s into a Config.
|
||||||
|
|
|
@ -207,6 +207,17 @@ var expectedConf = &Config{
|
||||||
Scheme: DefaultConsulSDConfig.Scheme,
|
Scheme: DefaultConsulSDConfig.Scheme,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
RelabelConfigs: []*RelabelConfig{
|
||||||
|
{
|
||||||
|
SourceLabels: model.LabelNames{"__meta_sd_consul_tags"},
|
||||||
|
Regex: MustNewRegexp("label:([^=]+)=([^,]+)"),
|
||||||
|
Separator: ",",
|
||||||
|
TargetLabel: "${1}",
|
||||||
|
Replacement: "${2}",
|
||||||
|
Action: RelabelReplace,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
JobName: "service-z",
|
JobName: "service-z",
|
||||||
|
|
7
config/testdata/conf.good.yml
vendored
7
config/testdata/conf.good.yml
vendored
|
@ -104,6 +104,13 @@ scrape_configs:
|
||||||
- server: 'localhost:1234'
|
- server: 'localhost:1234'
|
||||||
services: ['nginx', 'cache', 'mysql']
|
services: ['nginx', 'cache', 'mysql']
|
||||||
|
|
||||||
|
relabel_configs:
|
||||||
|
- source_labels: [__meta_sd_consul_tags]
|
||||||
|
separator: ','
|
||||||
|
regex: label:([^=]+)=([^,]+)
|
||||||
|
target_label: ${1}
|
||||||
|
replacement: ${2}
|
||||||
|
|
||||||
- job_name: service-z
|
- job_name: service-z
|
||||||
|
|
||||||
tls_config:
|
tls_config:
|
||||||
|
|
Loading…
Reference in a new issue