Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct nodeSummaryGroupSpec #2631

Merged
merged 2 commits into from
Jun 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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