Skip to content

Commit

Permalink
Merge pull request #2631 from weaveworks/2630-correct-nodeSummaryGrou…
Browse files Browse the repository at this point in the history
…pSpec

correct `nodeSummaryGroupSpec`
  • Loading branch information
rade authored Jun 21, 2017
2 parents 454bb8a + ae2a5ed commit 6b8a0e4
Showing 1 changed file with 55 additions and 86 deletions.
141 changes: 55 additions & 86 deletions render/detailed/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/weaveworks/scope/probe/awsecs"
"github.com/weaveworks/scope/probe/docker"
"github.com/weaveworks/scope/probe/host"
"github.com/weaveworks/scope/probe/kubernetes"
"github.com/weaveworks/scope/probe/process"
"github.com/weaveworks/scope/report"
Expand Down Expand Up @@ -126,103 +125,73 @@ func controls(r report.Report, n report.Node) []ControlInstance {
return []ControlInstance{}
}

var (
nodeSummaryGroupSpecs = []struct {
topologyID string
NodeSummaryGroup
}{
{
topologyID: report.Host,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Hosts",
Columns: []Column{
{ID: host.CPUUsage, Label: "CPU", Datatype: "number"},
{ID: host.MemoryUsage, Label: "Memory", Datatype: "number"},
},
// We only need to include topologies here where the nodes may appear
// as children of other nodes in some topology.
var nodeSummaryGroupSpecs = []struct {
topologyID string
NodeSummaryGroup
}{
{
topologyID: report.ReplicaSet,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Replica Sets",
Columns: []Column{
{ID: report.Pod, Label: "# Pods", Datatype: "number"},
{ID: kubernetes.ObservedGeneration, Label: "Observed Gen.", Datatype: "number"},
},
},
{
topologyID: report.Service,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Services",
Columns: []Column{
{ID: report.Pod, Label: "# Pods", Datatype: "number"},
{ID: kubernetes.IP, Label: "IP", Datatype: "ip"},
},
},
{
topologyID: report.Pod,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Pods",

Columns: []Column{
{ID: kubernetes.State, Label: "State"},
{ID: report.Container, Label: "# Containers", Datatype: "number"},
{ID: kubernetes.IP, Label: "IP", Datatype: "ip"},
},
},
{
topologyID: report.ReplicaSet,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Replica Sets",
Columns: []Column{
{ID: report.Pod, Label: "# Pods", Datatype: "number"},
{ID: kubernetes.ObservedGeneration, Label: "Observed Gen.", Datatype: "number"},
},
},
{
topologyID: report.ECSTask,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Tasks",
Columns: []Column{
{ID: awsecs.CreatedAt, Label: "Created At", Datatype: "datetime"},
},
},
{
topologyID: report.Pod,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Pods",

Columns: []Column{
{ID: kubernetes.State, Label: "State"},
{ID: report.Container, Label: "# Containers", Datatype: "number"},
{ID: kubernetes.IP, Label: "IP", Datatype: "ip"},
},
},
},
{
topologyID: report.ECSService,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Services",
Columns: []Column{
{ID: awsecs.ServiceRunningCount, Label: "Running", Datatype: "number"},
{ID: awsecs.ServiceDesiredCount, Label: "Desired", Datatype: "number"},
},
},
},
{
topologyID: report.ECSTask,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Tasks",
Columns: []Column{
{ID: awsecs.CreatedAt, Label: "Created At", Datatype: "datetime"},
},
},
{
topologyID: report.Container,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Containers", Columns: []Column{
{ID: docker.CPUTotalUsage, Label: "CPU", Datatype: "number"},
{ID: docker.MemoryUsage, Label: "Memory", Datatype: "number"},
},
},
{
topologyID: report.Container,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Containers", Columns: []Column{
{ID: docker.CPUTotalUsage, Label: "CPU", Datatype: "number"},
{ID: docker.MemoryUsage, Label: "Memory", Datatype: "number"},
},
},
{
topologyID: report.Process,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Processes", Columns: []Column{
{ID: process.PID, Label: "PID", Datatype: "number"},
{ID: process.CPUUsage, Label: "CPU", Datatype: "number"},
{ID: process.MemoryUsage, Label: "Memory", Datatype: "number"},
},
},
{
topologyID: report.Process,
NodeSummaryGroup: NodeSummaryGroup{
Label: "Processes", Columns: []Column{
{ID: process.PID, Label: "PID", Datatype: "number"},
{ID: process.CPUUsage, Label: "CPU", Datatype: "number"},
{ID: process.MemoryUsage, Label: "Memory", Datatype: "number"},
},
},
{
topologyID: report.ContainerImage,
NodeSummaryGroup: NodeSummaryGroup{
TopologyID: "containers-by-image",
Label: "Container Images",
Columns: []Column{
{ID: report.Container, Label: "# Containers", DefaultSort: true, Datatype: "number"},
},
},
{
topologyID: report.ContainerImage,
NodeSummaryGroup: NodeSummaryGroup{
TopologyID: "containers-by-image",
Label: "Container Images",
Columns: []Column{
{ID: report.Container, Label: "# Containers", DefaultSort: true, Datatype: "number"},
},
},
},
}
)
},
}

func children(r report.Report, n report.Node) []NodeSummaryGroup {
summaries := map[string][]NodeSummary{}
Expand Down

0 comments on commit 6b8a0e4

Please sign in to comment.