Skip to content

Commit

Permalink
Refactor: move pseudoNodeID beside other ID functions
Browse files Browse the repository at this point in the history
  • Loading branch information
bboreham committed Nov 6, 2017
1 parent 20b1794 commit 8f22634
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
15 changes: 15 additions & 0 deletions render/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ func NewDerivedPseudoNode(id string, node report.Node) report.Node {
return output
}

func pseudoNodeID(n report.Node, local report.Networks) (string, bool) {
_, addr, _, ok := report.ParseEndpointNodeID(n.ID)
if !ok {
return "", false
}

if id, ok := externalNodeID(n, addr, local); ok {
return id, ok
}

// due to https://github.com/weaveworks/scope/issues/1323 we are dropping
// all non-external pseudo nodes for now.
return "", false
}

// figure out if a node should be considered external and returns an ID which can be used to create a pseudo node
func externalNodeID(n report.Node, addr string, local report.Networks) (string, bool) {
// First, check if it's a known service and emit a a specific node if it
Expand Down
15 changes: 0 additions & 15 deletions render/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,6 @@ var ProcessNameRenderer = ConditionalRenderer(renderProcesses,
),
)

func pseudoNodeID(n report.Node, local report.Networks) (string, bool) {
_, addr, _, ok := report.ParseEndpointNodeID(n.ID)
if !ok {
return "", false
}

if id, ok := externalNodeID(n, addr, local); ok {
return id, ok
}

// due to https://github.com/weaveworks/scope/issues/1323 we are dropping
// all non-external pseudo nodes for now.
return "", false
}

// endpoints2Processes joins the endpoint topology to the process
// topology, matching on hostID and pid.
type endpoints2Processes struct {
Expand Down

0 comments on commit 8f22634

Please sign in to comment.