Commit Graph

615 Commits

Author SHA1 Message Date
Matthias Radestock
3582c221fe processes are now always linkable 2018-01-02 09:47:15 +00:00
Matthias Radestock
74c72945ef optimisation: no need to prune adjacencies in filterUnconnected
since, by definition, unconnected nodes do not appear in adjacencies
of other nodes
2018-01-02 06:41:19 +00:00
Matthias Radestock
915535e0a2 Merge pull request #3007 from weaveworks/less-derived-node-metadata
remove unnecessary metadata propagation
2017-12-29 15:10:48 +00:00
Matthias Radestock
c8ea7ba49e refactor: simplify joinResults.add*
After dropping extra metadata in the rest of this PR, our usage of
joinResults.add* only ever ends creating minimal nodes, from just an
id and topology. Hence joinResults.add* can be invoked with simply an
id and topology instead of a generic node creation function.
2017-12-29 14:40:18 +00:00
Matthias Radestock
a7b6bb09a1 refactor: lift closures and extract constants 2017-12-29 14:40:18 +00:00
Matthias Radestock
2d6badba79 cope with processes that have no HostNodeID metadata
Some process nodes may not have a HostNodeID metadata, e.g. when an
endpoint references a pid that we know nothing about. When mapping
processes to containers, we therefore shouldn't rely on
HostNodeID. Instead we can obtain the hostID from the process node ID.

This has been broken for a while, possibly forever.
2017-12-29 14:40:16 +00:00
Matthias Radestock
ff03d7d86e Merge pull request #3008 from weaveworks/propagate-single-metrics-renderer
refactor: make PropagateSingleMetrics a renderer
2017-12-29 14:18:09 +00:00
Matthias Radestock
ecf1cf43f6 Merge pull request #3005 from weaveworks/move-rendercontext
refactor: move RenderContext where it belongs
2017-12-29 14:16:59 +00:00
Matthias Radestock
4984da6f04 fly-by optimisation
save a few allocations
2017-12-28 20:04:01 +00:00
Matthias Radestock
30bef738c0 refactor: make PropagateSingleMetrics a renderer
instead of a Map, since it's not really a map as it just updates the
given node.

This is more efficient and also matches what we do in similar
situations elsewhere, e.g. in ContainerWithImageNameRenderer and
ProcessWithContainerNameRenderer.
2017-12-28 20:04:01 +00:00
Matthias Radestock
4c1d5640ae don't propagate IsConnectedMark in MapProcess2Container
...when creating Uncontained pseudo nodes. IsConnectedMark only
affects summarisation of genuine process nodes.
2017-12-28 12:56:52 +00:00
Matthias Radestock
5d06f90f10 don't propagate HostNodeID in MapProcess2Container
...when creating Uncontained pseudo nodes. Summarisation of
Uncontained/Umanaged only looks at the ID, which includes the
HostNodeID.

We adjust the promotion of Uncontained to Unmanaged, to operate on the
ID instead of (re)extracting the hostID from the HostNodeID
metadata. With that, nothing looks at the HostNodeID metadata of
Uncontained/Unmanaged nodes.
2017-12-28 12:54:21 +00:00
Matthias Radestock
7ce160d492 don't propagate ImageID in MapContainer2ContainerImage
The ImageID is already the id of the node we are creation, and that's
what summarisation renders in the event we fail to join this node with
a node from the ContainerImage topology that has more metadata.
Nothing is looking at the ImageID metadata field.
2017-12-28 12:50:11 +00:00
Matthias Radestock
9034296209 don't propagate ImageID in MapContainerImage2Name
This was building a set of all the image ids represented by the same
unversioned image. Well, it was doing that until I broke it with a
silly mistake in #1739 - instead of extracting the imageID from the
original node ID, it's extracting it from the updated ID, which is the
unversioned image. Even if it was working though, it's pointless
since nothing is looking at that info.
2017-12-28 12:50:11 +00:00
Matthias Radestock
a46b9c9c24 don't propagate ContainerHostname in MapContainer2Hostname
The container hostname is already the id of the node, and that's what
summarisation renders. Nothing looks at the docker.ContainerHostname
metadata of nodes in the ContainerHostname group topology.
2017-12-28 12:50:11 +00:00
Matthias Radestock
bbd6c5fe47 don't propagate HostNodeID in endpoints2Hosts
The HostNodeID is already the id of host nodes (as the name suggests),
and that's what summarisation renders. Nothing looks at the HostNodeID
metadata of host nodes.
2017-12-28 12:50:11 +00:00
Matthias Radestock
a3ba3a5a55 don't propagate Name in processes2Names
The name is already the id of the node, and that's what summarisation
renders. Nothing looks at process.Name.
2017-12-28 12:50:11 +00:00
Matthias Radestock
d7e90303a6 don't propagate PID in endpoints2Processes
The 'create' function passed to addChild is only ever invoked when we
cannot find a matching process in the process topology. In these cases
the host and pid will be _all_ the info we are ever going to have,
both of which are incorporated in the id. Node summarisation renders
that as best it can; adding the PID as metadata does not make a
difference but for a line with that info in the detail panel, which
adds nothing since the PID is already included in the label.
2017-12-28 12:50:11 +00:00
Matthias Radestock
27c2f3a5d2 refactor: use propagateLatest
instead of the equivalent long-hand code.
2017-12-28 12:50:11 +00:00
Matthias Radestock
e69c8209fb remove redundant operation
We were setting the very same k/v that we just looked up.
2017-12-28 12:50:11 +00:00
Matthias Radestock
a8ad7f8898 refactor: simplify summarisation of internet nodes 2017-12-28 12:48:13 +00:00
Matthias Radestock
3d1a44aae0 extract label from id when summarising un[contained,managed]
I missed this in #2998.
2017-12-28 12:48:12 +00:00
Matthias Radestock
286453b9a9 refactor: move RenderContext where it belongs
It shouldn't be in 'report' because that is shared between the probe
and the app, and RenderContext, as the name suggests, is only needed
in the app.
2017-12-27 16:22:52 +00:00
Matthias Radestock
0b4512bd9b refactor: clarify and comment on summarisation logic 2017-12-27 13:54:30 +00:00
Matthias Radestock
705c6d159d sensible defaults/fallback for label and shape 2017-12-27 13:54:30 +00:00
Matthias Radestock
4206760021 refactor: lift some code out of inner loop 2017-12-27 13:54:30 +00:00
Matthias Radestock
7c5e9339bb render parents which we cannot resolve
The id and topology are enough to get some basic info for rendering.

This isn't just a fall-through for exceptional cases.
ContainerwithImageNameRenderer produces parent references using the
image name without version as the ID, and containers-by-image topology
uses that for grouping. By contrast, the container-image topology in
the report is keyed on docker image IDs.
2017-12-27 13:54:30 +00:00
Matthias Radestock
b88a2e4509 render sensible labels for parent nodes with little/no metadata
We eliminate the custom parent renderer, which was a very partial
implementation MakeBasicNodeSummary.

We also ensure that parents are always rendered in the same, sensible
order. Previously the order was an alphabetic sort of the parent
topology IDs. Now lower level topologies come before higher level
topologies.
2017-12-27 13:54:30 +00:00
Matthias Radestock
8cf65ea8b6 use BasicNodeSummary for rendering links in connection table
instead of the full NodeSummary
2017-12-27 13:54:30 +00:00
Matthias Radestock
0237b13916 refactor: extract BasicNodeSummary
This is sufficient for rendering links to nodes, and is cheaper to
compute that the full NodeSummary.
2017-12-27 13:54:30 +00:00
Matthias Radestock
367f2db003 always render metric urls
Fixes an omission.
2017-12-27 13:54:29 +00:00
Matthias Radestock
d1149dc29e add a basic test for rendering nodes with little/no metadata 2017-12-27 13:54:29 +00:00
Matthias Radestock
a9b8ced0a7 refactor: drop superfluous return value
Now that summary renderers always produce something, they no longer
need to indicate whether they did.
2017-12-27 13:54:29 +00:00
Matthias Radestock
da11655659 render sensible labels for group nodes with little/no metadata
The node ID of group nodes is in fact the same value as we get from
looking up the metadata key contained in the group topology id. So
just use that since a) we always have it, and b) we save a LatestMap
lookup.
2017-12-27 13:54:29 +00:00
Matthias Radestock
15881cd7fd render sensible labels for weave peer nodes with little/no metadata
We fall back to using the peerName as the label, which we always have.
2017-12-27 13:54:29 +00:00
Matthias Radestock
5e099640eb render sensible labels for swarm service nodes with little/no metadata
We fall back to using the service ID as the label.
2017-12-27 13:54:29 +00:00
Matthias Radestock
9aed0792ac render sensible labels for ecs task nodes with little/no metadata
We fall back to using the ARN as the label.
2017-12-27 13:54:29 +00:00
Matthias Radestock
289226707d render sensible labels for k8s nodes with little/no metadata
We fall back to using the object id as the label.
2017-12-27 13:54:29 +00:00
Matthias Radestock
f192e79346 render sensible labels for host nodes with little/no metadata
The node id, which we always have, actually contains the hostname.
2017-12-27 13:54:29 +00:00
Matthias Radestock
b83f7e8ce6 render sensible labels for images with little/no metadata
We fall back to image id when we cannot find a name. We extract the
image id from the node id rather than the docker.ImageID latest map
entry since that way we are guaranteed to get it.
2017-12-27 13:54:29 +00:00
Matthias Radestock
19dc67b6cf render sensible labels for pseudo nodes with little/no metadata
The main change here is to to label the node with its pseudoID as the
last resort.

We also set the rank to the pseudoID instead of the full node id,
since including the "pseudo:" prefix is not conducive to good ranking.

The rest is just moving from 'if' to 'switch'.
2017-12-27 13:54:27 +00:00
Matthias Radestock
d92c4b12c3 render sensible labels for containers with little/no metadata
We fall back to the truncated container id when we cannot find a
name. NB: this also happens when rendering a container as a parent.

We cope with the absence of an image name and/or host name.
2017-12-27 13:54:08 +00:00
Matthias Radestock
e5149aa7cd render sensible labels for processes with little/no metadata
We cope with the absence of the process name and/or container name,
and extract the hostID and pid from the node id rather than metadata
since that way we are guaranteed to get values for them.
2017-12-27 13:54:07 +00:00
Matthias Radestock
ec589e08f6 refactor: introduce ParseGroupNodeTopology 2017-12-26 02:27:54 +00:00
Matthias Radestock
b8eeadda34 refactor: don't set shape based on unitialised topology
This doesn't make any difference to the outcome - we were simply
setting the shape in the NodeSummary to "", which is what it starts
out as - but looks less weird in the code.
2017-12-26 02:27:54 +00:00
Matthias Radestock
bd214227dc introduce ParsePseudoNodeID
unused for now

A convenient place to document and deal with the ugliness.
2017-12-26 02:27:54 +00:00
Matthias Radestock
56a1efd38a optimisation: pre-allocate some maps
This doesn't make much of a difference, since we don't create many of
these. But it's easy enough to do, and every little helps.
2017-12-26 00:35:02 +00:00
Matthias Radestock
590fa55cf5 refactor: banish TheInternet
TheInternet hasn't existed as a single node for a long time.

We also move & export the IsInternetNode predicate so it can be used
in more places.
2017-12-25 18:29:04 +00:00
Matthias Radestock
ceb3539d35 ensure hostNodeIDs actually are what they claim
It's a dynamic type check of sorts.

In the process we stop abusing ParseNodeID for extracting the host,
which in turn allows us to clarify its purpose.
2017-12-25 18:14:34 +00:00
Matthias Radestock
a8e3d04d21 cosmetic: fix some comments 2017-12-25 16:21:46 +00:00