diff --git a/app/router.go b/app/router.go index 575b705f76..b294949f44 100644 --- a/app/router.go +++ b/app/router.go @@ -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, ""}, } diff --git a/report/mapping_functions.go b/report/mapping_functions.go index 38e54dfd20..f739edcba3 100644 --- a/report/mapping_functions.go +++ b/report/mapping_functions.go @@ -5,6 +5,8 @@ import ( "strings" ) +const humanTheInternet = "the Internet" + // MappedNode is returned by the MapFuncs. type MappedNode struct { ID string @@ -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. @@ -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) @@ -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 }