mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
This commit is contained in:
parent
7a2c46d951
commit
68a117a25a
2 changed files with 8 additions and 7 deletions
|
@ -94,6 +94,7 @@ func addTasksLabels(tasks []task, nodesLabels, servicesLabels []map[string]strin
|
|||
}
|
||||
addLabels(commonLabels, servicesLabels, "__meta_dockerswarm_service_id", task.ServiceID)
|
||||
addLabels(commonLabels, nodesLabels, "__meta_dockerswarm_node_id", task.NodeID)
|
||||
delete(commonLabels, "__address__")
|
||||
|
||||
for _, port := range task.Status.PortStatus.Ports {
|
||||
if port.Protocol != "tcp" {
|
||||
|
@ -121,7 +122,7 @@ func addTasksLabels(tasks []task, nodesLabels, servicesLabels []map[string]strin
|
|||
continue
|
||||
}
|
||||
m := map[string]string{
|
||||
"__address": discoveryutils.JoinHostPort(ip.String(), ep.PublishedPort),
|
||||
"__address__": discoveryutils.JoinHostPort(ip.String(), ep.PublishedPort),
|
||||
"__meta_dockerswarm_task_port_publish_mode": ep.PublishMode,
|
||||
}
|
||||
for k, v := range commonLabels {
|
||||
|
|
|
@ -167,7 +167,7 @@ func Test_addTasksLabels(t *testing.T) {
|
|||
},
|
||||
want: [][]prompbmarshal.Label{
|
||||
discoveryutils.GetSortedLabels(map[string]string{
|
||||
"__address__": "172.31.40.97:9100",
|
||||
"__address__": "172.31.40.97:6379",
|
||||
"__meta_dockerswarm_node_address": "172.31.40.97",
|
||||
"__meta_dockerswarm_node_availability": "active",
|
||||
"__meta_dockerswarm_node_engine_version": "19.03.11",
|
||||
|
@ -295,9 +295,10 @@ func Test_addTasksLabels(t *testing.T) {
|
|||
}{
|
||||
Ports: []portConfig{
|
||||
{
|
||||
Protocol: "tcp",
|
||||
Name: "redis",
|
||||
PublishMode: "ingress",
|
||||
Protocol: "tcp",
|
||||
Name: "redis",
|
||||
PublishMode: "ingress",
|
||||
PublishedPort: 6379,
|
||||
},
|
||||
}, VirtualIPs: []struct {
|
||||
NetworkID string
|
||||
|
@ -315,8 +316,7 @@ func Test_addTasksLabels(t *testing.T) {
|
|||
},
|
||||
want: [][]prompbmarshal.Label{
|
||||
discoveryutils.GetSortedLabels(map[string]string{
|
||||
"__address": "10.10.15.15:0",
|
||||
"__address__": "172.31.40.97:9100",
|
||||
"__address__": "10.10.15.15:6379",
|
||||
"__meta_dockerswarm_network_id": "qs0hog6ldlei9ct11pr3c77v1",
|
||||
"__meta_dockerswarm_network_ingress": "true",
|
||||
"__meta_dockerswarm_network_internal": "false",
|
||||
|
|
Loading…
Reference in a new issue