mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 01:31:17 +00:00
Add method to add a single string into Sets
This avoids creating and discarding a StringSet just to pass the parameter
This commit is contained in:
@@ -182,10 +182,10 @@ func (r Reporter) Tag(rpt report.Report) (report.Report, error) {
|
||||
|
||||
// parents sets to merge into all matching container nodes
|
||||
parentsSets := report.MakeSets()
|
||||
parentsSets = parentsSets.Add(report.ECSTask, report.MakeStringSet(taskID))
|
||||
parentsSets = parentsSets.AddString(report.ECSTask, taskID)
|
||||
if serviceName, ok := ecsInfo.TaskServiceMap[taskArn]; ok {
|
||||
serviceID := report.MakeECSServiceNodeID(cluster, serviceName)
|
||||
parentsSets = parentsSets.Add(report.ECSService, report.MakeStringSet(serviceID))
|
||||
parentsSets = parentsSets.AddString(report.ECSService, serviceID)
|
||||
// in addition, make service parent of task
|
||||
rpt.ECSTask.Nodes[taskID] = rpt.ECSTask.Nodes[taskID].WithParents(report.MakeSets().Add(report.ECSService, report.MakeStringSet(serviceID)))
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ func (p *pod) UID() string {
|
||||
}
|
||||
|
||||
func (p *pod) AddParent(topology, id string) {
|
||||
p.parents = p.parents.Add(topology, report.MakeStringSet(id))
|
||||
p.parents = p.parents.AddString(topology, id)
|
||||
}
|
||||
|
||||
func (p *pod) State() string {
|
||||
|
||||
@@ -357,7 +357,7 @@ func (r *Reporter) hostTopology(services []Service) report.Topology {
|
||||
t := report.MakeTopology()
|
||||
t.AddNode(
|
||||
report.MakeNode(report.MakeHostNodeID(r.hostID)).
|
||||
WithSets(report.MakeSets().Add(host.LocalNetworks, report.MakeStringSet(serviceNetwork.String()))))
|
||||
WithSets(report.MakeSets().AddString(host.LocalNetworks, serviceNetwork.String())))
|
||||
return t
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user