mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 17:51:21 +00:00
Switch to LatestMap-style node controls
This allows plugins to add controls to nodes that already have some controls set by other plugin. Previously only the last plugin that sets the controls in the node would have its controls visible. That was because of NodeControls' Merge function that actually weren't merging data from two inputs, but rather returning data that was newer and discarding the older one.
This commit is contained in:
@@ -2,6 +2,7 @@ package detailed
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/ugorji/go/codec"
|
||||
|
||||
@@ -98,20 +99,22 @@ func controlsFor(topology report.Topology, nodeID string) []ControlInstance {
|
||||
if !ok {
|
||||
return result
|
||||
}
|
||||
|
||||
for _, id := range node.Controls.Controls {
|
||||
if control, ok := topology.Controls[id]; ok {
|
||||
probeID, ok := node.Latest.Lookup(report.ControlProbeID)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
probeID, ok := node.Latest.Lookup(report.ControlProbeID)
|
||||
if !ok {
|
||||
return result
|
||||
}
|
||||
node.LatestControls.ForEach(func(controlID string, _ time.Time, data report.NodeControlData) {
|
||||
if data.Dead {
|
||||
return
|
||||
}
|
||||
if control, ok := topology.Controls[controlID]; ok {
|
||||
result = append(result, ControlInstance{
|
||||
ProbeID: probeID,
|
||||
NodeID: nodeID,
|
||||
Control: control,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user