performance: Send active controls as a single string per node

Instead of a whole extra data structure which is quite expensive to
marshal and unmarshal, just send the information in a string.  No
clever merging strategy is required - the states are all set in one
place per node type.
This commit is contained in:
Bryan Boreham
2019-10-14 15:31:34 +00:00
parent 83f9d4ec8d
commit 0b641b1848
9 changed files with 64 additions and 362 deletions

View File

@@ -2,7 +2,6 @@ package detailed
import (
"sort"
"time"
"github.com/ugorji/go/codec"
@@ -112,10 +111,7 @@ func controlsFor(topology report.Topology, nodeID string) []ControlInstance {
if !ok {
return result
}
node.LatestControls.ForEach(func(controlID string, _ time.Time, data report.NodeControlData) {
if data.Dead {
return
}
for _, controlID := range node.ActiveControls() {
if control, ok := topology.Controls[controlID]; ok {
result = append(result, ControlInstance{
ProbeID: probeID,
@@ -123,7 +119,7 @@ func controlsFor(topology report.Topology, nodeID string) []ControlInstance {
Control: control,
})
}
})
}
return result
}