diff --git a/app/router.go b/app/router.go index d6b6b8e7b..d121a7872 100644 --- a/app/router.go +++ b/app/router.go @@ -47,6 +47,6 @@ var topologyRegistry = map[string]struct { hasGrouped bool typ string }{ - "applications": {"Applications", selectProcess, report.ProcessName, true, "Process"}, + "applications": {"Applications", selectProcess, report.ProcessPID, true, "Process"}, "hosts": {"Hosts", selectNetwork, report.NetworkHostname, false, "Network"}, } diff --git a/report/mapping_functions.go b/report/mapping_functions.go index 8074a1753..3cbc93ce9 100644 --- a/report/mapping_functions.go +++ b/report/mapping_functions.go @@ -26,13 +26,14 @@ type MappedNode struct { type MapFunc func(string, NodeMetadata, bool) (MappedNode, bool) // ProcessPID takes a node NodeMetadata from a Process topology, and returns a -// representation based on the process PID. +// representation with the ID based on the process PID and the labels based +// on the process name. func ProcessPID(id string, m NodeMetadata, grouped bool) (MappedNode, bool) { var ( domain = m["domain"] pid = m["pid"] name = m["name"] - minor = fmt.Sprintf("%s (%s)", domain, name) + minor = fmt.Sprintf("%s (%s)", domain, pid) ) if grouped { @@ -42,7 +43,7 @@ func ProcessPID(id string, m NodeMetadata, grouped bool) (MappedNode, bool) { return MappedNode{ ID: fmt.Sprintf("pid:%s:%s", domain, pid), - Major: pid, + Major: name, Minor: minor, Rank: pid, }, pid != "" diff --git a/report/mapping_test.go b/report/mapping_test.go index c9671712f..d72378c53 100644 --- a/report/mapping_test.go +++ b/report/mapping_test.go @@ -73,8 +73,8 @@ func TestMapping(t *testing.T) { }, wantOK: true, wantID: "pid:hosta:42", - wantMajor: "42", - wantMinor: "hosta (curl)", + wantMajor: "curl", + wantMinor: "hosta (42)", wantRank: "42", }, {