mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-29 07:29:42 -08:00
Merge pull request #920 from prometheus/beorn7/sd
Add Consul ServicePort and ServiceAddress to the meta labels.
This commit is contained in:
commit
6ee7eb79ae
|
@ -33,12 +33,18 @@ const (
|
||||||
consulWatchTimeout = 30 * time.Second
|
consulWatchTimeout = 30 * time.Second
|
||||||
consulRetryInterval = 15 * time.Second
|
consulRetryInterval = 15 * time.Second
|
||||||
|
|
||||||
|
// ConsuleAddressLabel is the name for the label containing a target's address.
|
||||||
|
ConsulAddressLabel = clientmodel.MetaLabelPrefix + "consul_address"
|
||||||
// ConsuleNodeLabel is the name for the label containing a target's node name.
|
// ConsuleNodeLabel is the name for the label containing a target's node name.
|
||||||
ConsulNodeLabel = clientmodel.MetaLabelPrefix + "consul_node"
|
ConsulNodeLabel = clientmodel.MetaLabelPrefix + "consul_node"
|
||||||
// ConsulTagsLabel is the name of the label containing the tags assigned to the target.
|
// ConsulTagsLabel is the name of the label containing the tags assigned to the target.
|
||||||
ConsulTagsLabel = clientmodel.MetaLabelPrefix + "consul_tags"
|
ConsulTagsLabel = clientmodel.MetaLabelPrefix + "consul_tags"
|
||||||
// ConsulServiceLabel is the name of the label containing the service name.
|
// ConsulServiceLabel is the name of the label containing the service name.
|
||||||
ConsulServiceLabel = clientmodel.MetaLabelPrefix + "consul_service"
|
ConsulServiceLabel = clientmodel.MetaLabelPrefix + "consul_service"
|
||||||
|
// ConsulServiceAddressLabel is the name of the label containing the (optional) service address.
|
||||||
|
ConsulServiceAddressLabel = clientmodel.MetaLabelPrefix + "consul_service_address"
|
||||||
|
// ConsulServicePortLabel is the name of the label containing the service port.
|
||||||
|
ConsulServicePortLabel = clientmodel.MetaLabelPrefix + "consul_service_port"
|
||||||
// ConsulDCLabel is the name of the label containing the datacenter ID.
|
// ConsulDCLabel is the name of the label containing the datacenter ID.
|
||||||
ConsulDCLabel = clientmodel.MetaLabelPrefix + "consul_dc"
|
ConsulDCLabel = clientmodel.MetaLabelPrefix + "consul_dc"
|
||||||
)
|
)
|
||||||
|
@ -264,9 +270,12 @@ func (cd *ConsulDiscovery) watchService(srv *consulService, ch chan<- *config.Ta
|
||||||
tags := cd.tagSeparator + strings.Join(node.ServiceTags, cd.tagSeparator) + cd.tagSeparator
|
tags := cd.tagSeparator + strings.Join(node.ServiceTags, cd.tagSeparator) + cd.tagSeparator
|
||||||
|
|
||||||
srv.tgroup.Targets = append(srv.tgroup.Targets, clientmodel.LabelSet{
|
srv.tgroup.Targets = append(srv.tgroup.Targets, clientmodel.LabelSet{
|
||||||
clientmodel.AddressLabel: clientmodel.LabelValue(addr),
|
clientmodel.AddressLabel: clientmodel.LabelValue(addr),
|
||||||
ConsulNodeLabel: clientmodel.LabelValue(node.Node),
|
ConsulAddressLabel: clientmodel.LabelValue(node.Address),
|
||||||
ConsulTagsLabel: clientmodel.LabelValue(tags),
|
ConsulNodeLabel: clientmodel.LabelValue(node.Node),
|
||||||
|
ConsulTagsLabel: clientmodel.LabelValue(tags),
|
||||||
|
ConsulServiceAddressLabel: clientmodel.LabelValue(node.ServiceAddress),
|
||||||
|
ConsulServicePortLabel: clientmodel.LabelValue(node.ServicePort),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue