mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-13 06:47:28 -08:00
Merge pull request #12372 from roidelapluie/consul_path_prefix
Add support for consul path_prefix
This commit is contained in:
commit
e53478a08d
|
@ -363,6 +363,7 @@ var expectedConf = &Config{
|
||||||
ServiceDiscoveryConfigs: discovery.Configs{
|
ServiceDiscoveryConfigs: discovery.Configs{
|
||||||
&consul.SDConfig{
|
&consul.SDConfig{
|
||||||
Server: "localhost:1234",
|
Server: "localhost:1234",
|
||||||
|
PathPrefix: "/consul",
|
||||||
Token: "mysecret",
|
Token: "mysecret",
|
||||||
Services: []string{"nginx", "cache", "mysql"},
|
Services: []string{"nginx", "cache", "mysql"},
|
||||||
ServiceTags: []string{"canary", "v1"},
|
ServiceTags: []string{"canary", "v1"},
|
||||||
|
|
1
config/testdata/conf.good.yml
vendored
1
config/testdata/conf.good.yml
vendored
|
@ -151,6 +151,7 @@ scrape_configs:
|
||||||
consul_sd_configs:
|
consul_sd_configs:
|
||||||
- server: "localhost:1234"
|
- server: "localhost:1234"
|
||||||
token: mysecret
|
token: mysecret
|
||||||
|
path_prefix: /consul
|
||||||
services: ["nginx", "cache", "mysql"]
|
services: ["nginx", "cache", "mysql"]
|
||||||
tags: ["canary", "v1"]
|
tags: ["canary", "v1"]
|
||||||
node_meta:
|
node_meta:
|
||||||
|
|
|
@ -111,6 +111,7 @@ func init() {
|
||||||
// SDConfig is the configuration for Consul service discovery.
|
// SDConfig is the configuration for Consul service discovery.
|
||||||
type SDConfig struct {
|
type SDConfig struct {
|
||||||
Server string `yaml:"server,omitempty"`
|
Server string `yaml:"server,omitempty"`
|
||||||
|
PathPrefix string `yaml:"path_prefix,omitempty"`
|
||||||
Token config.Secret `yaml:"token,omitempty"`
|
Token config.Secret `yaml:"token,omitempty"`
|
||||||
Datacenter string `yaml:"datacenter,omitempty"`
|
Datacenter string `yaml:"datacenter,omitempty"`
|
||||||
Namespace string `yaml:"namespace,omitempty"`
|
Namespace string `yaml:"namespace,omitempty"`
|
||||||
|
@ -211,6 +212,7 @@ func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) {
|
||||||
|
|
||||||
clientConf := &consul.Config{
|
clientConf := &consul.Config{
|
||||||
Address: conf.Server,
|
Address: conf.Server,
|
||||||
|
PathPrefix: conf.PathPrefix,
|
||||||
Scheme: conf.Scheme,
|
Scheme: conf.Scheme,
|
||||||
Datacenter: conf.Datacenter,
|
Datacenter: conf.Datacenter,
|
||||||
Namespace: conf.Namespace,
|
Namespace: conf.Namespace,
|
||||||
|
|
|
@ -585,6 +585,8 @@ The following meta labels are available on targets during [relabeling](#relabel_
|
||||||
# The information to access the Consul API. It is to be defined
|
# The information to access the Consul API. It is to be defined
|
||||||
# as the Consul documentation requires.
|
# as the Consul documentation requires.
|
||||||
[ server: <host> | default = "localhost:8500" ]
|
[ server: <host> | default = "localhost:8500" ]
|
||||||
|
# Prefix for URIs for when consul is behind an API gateway (reverse proxy).
|
||||||
|
[ path_prefix: <string> ]
|
||||||
[ token: <secret> ]
|
[ token: <secret> ]
|
||||||
[ datacenter: <string> ]
|
[ datacenter: <string> ]
|
||||||
# Namespaces are only supported in Consul Enterprise.
|
# Namespaces are only supported in Consul Enterprise.
|
||||||
|
|
Loading…
Reference in a new issue