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

Restore the internet node to the container topologies. #126

Merged
merged 1 commit into from
May 27, 2015
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions app/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type topologyView struct {
var topologyRegistry = map[string]topologyView{
"applications": {"Applications", selectProcess, report.ProcessPID, report.GenericPseudoNode, "applications-grouped"},
"applications-grouped": {"Applications", selectProcess, report.ProcessName, report.GenericGroupedPseudoNode, ""},
"containers": {"Containers", selectProcess, report.ProcessContainer, report.NoPseudoNode, "containers-grouped"},
"containers-grouped": {"Containers", selectProcess, report.ProcessContainerImage, report.NoPseudoNode, ""},
"containers": {"Containers", selectProcess, report.ProcessContainer, report.InternetOnlyPseudoNode, "containers-grouped"},
"containers-grouped": {"Containers", selectProcess, report.ProcessContainerImage, report.InternetOnlyPseudoNode, ""},
"hosts": {"Hosts", selectNetwork, report.NetworkHostname, report.GenericPseudoNode, ""},
}
13 changes: 9 additions & 4 deletions report/mapping_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"strings"
)

const humanTheInternet = "the Internet"

// MappedNode is returned by the MapFuncs.
type MappedNode struct {
ID string
Expand Down Expand Up @@ -129,7 +131,7 @@ func GenericPseudoNode(src string, srcMapped RenderableNode, dst string) (Mapped

if dst == TheInternet {
outputID = dst
maj, min = "the Internet", ""
maj, min = humanTheInternet, ""
} else {
// Rule for non-internet psuedo nodes; emit 1 new node for each
// dstNodeAddr, srcNodeAddr, srcNodePort.
Expand All @@ -154,7 +156,7 @@ func GenericGroupedPseudoNode(src string, srcMapped RenderableNode, dst string)

if dst == TheInternet {
outputID = dst
maj, min = "the Internet", ""
maj, min = humanTheInternet, ""
} else {
// When grouping, emit one pseudo node per (srcNodeAddress, dstNodeAddr)
dstNodeAddr, _ := trySplitAddr(dst)
Expand All @@ -170,8 +172,11 @@ func GenericGroupedPseudoNode(src string, srcMapped RenderableNode, dst string)
}, true
}

// NoPseudoNode never creates a pseudo node.
func NoPseudoNode(string, RenderableNode, string) (MappedNode, bool) {
// InternetOnlyPseudoNode never creates a pseudo node, unless it's the Internet.
func InternetOnlyPseudoNode(_ string, _ RenderableNode, dst string) (MappedNode, bool) {
if dst == TheInternet {
return MappedNode{ID: TheInternet, Major: humanTheInternet}, true
}
return MappedNode{}, false
}

Expand Down