mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-14 15:27:47 -08:00
Kubernetes SD: Use node name as instance label
This commit is contained in:
parent
bbdfb10da1
commit
ea9a173008
|
@ -37,8 +37,6 @@ const (
|
||||||
// kubernetesMetaLabelPrefix is the meta prefix used for all meta labels.
|
// kubernetesMetaLabelPrefix is the meta prefix used for all meta labels.
|
||||||
// in this discovery.
|
// in this discovery.
|
||||||
metaLabelPrefix = model.MetaLabelPrefix + "kubernetes_"
|
metaLabelPrefix = model.MetaLabelPrefix + "kubernetes_"
|
||||||
// nodeLabel is the name for the label containing a target's node name.
|
|
||||||
nodeLabel = metaLabelPrefix + "node"
|
|
||||||
// serviceNamespaceLabel is the name for the label containing a target's service namespace.
|
// serviceNamespaceLabel is the name for the label containing a target's service namespace.
|
||||||
serviceNamespaceLabel = metaLabelPrefix + "service_namespace"
|
serviceNamespaceLabel = metaLabelPrefix + "service_namespace"
|
||||||
// serviceNameLabel is the name for the label containing a target's service name.
|
// serviceNameLabel is the name for the label containing a target's service name.
|
||||||
|
@ -324,7 +322,7 @@ func (kd *Discovery) updateNodesTargetGroup() *config.TargetGroup {
|
||||||
|
|
||||||
t := model.LabelSet{
|
t := model.LabelSet{
|
||||||
model.AddressLabel: model.LabelValue(address),
|
model.AddressLabel: model.LabelValue(address),
|
||||||
nodeLabel: model.LabelValue(nodeName),
|
model.InstanceLabel: model.LabelValue(nodeName),
|
||||||
}
|
}
|
||||||
for k, v := range node.ObjectMeta.Labels {
|
for k, v := range node.ObjectMeta.Labels {
|
||||||
labelName := strutil.SanitizeLabelName(nodeLabelPrefix + k)
|
labelName := strutil.SanitizeLabelName(nodeLabelPrefix + k)
|
||||||
|
|
Loading…
Reference in a new issue