Commit Graph

4592 Commits

Author SHA1 Message Date
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
c2b0e568c3 Merge branch 'master' of github.com:weaveworks/scope 2017-12-28 12:48:59 +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
0c6b5b3a25 refactor: simplify summarisation of internet nodes 2017-12-28 10:28:33 +00:00
Matthias Radestock
569ccb7124 extract label from id when summarising un[contained,managed]
I missed this in #2998.
2017-12-28 10:18:23 +00:00
Matthias Radestock
5a6a6dfd58 remove from cruft from Makefile
This was left over from #1345.
2017-12-27 16:34:00 +00:00
Matthias Radestock
36c0d854bf Merge pull request #2998 from weaveworks/node-label-fallbacks
render sensible labels for nodes with little/no metadata
2017-12-27 14:59:33 +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
a9e5b99a74 add benchmarks for rendering & summarising processes-by-name 2017-12-26 11:59:50 +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
0cb34b53cc introduce ParseProcessNodeID
unused for now
2017-12-26 02:27:53 +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
e4ec31cc55 Merge pull request #3003 from weaveworks/banish-theinternet
refactor: banish TheInternet
2017-12-25 19:07:10 +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
Matthias Radestock
38e389e519 optimisation of Copy()ing/Merge()ing some report data structures
We consistently

- pre-allocate in Copy()
- merge the smaller into a copy of the larger in Merge()

This doesn't make much of a difference overall, since there are
comparatively few instances of these structures. But it costs little
in the code, and the consistency alone is worth it.
2017-12-25 14:16:20 +00:00
Matthias Radestock
50e70103c4 Merge pull request #3002 from weaveworks/summarize-preallocate
optimisation: pre-allocate, and fewer slices during summarisation
2017-12-25 13:13:58 +00:00
Matthias Radestock
3de04685f8 optimisation: pre-allocate, and fewer slices during summarisation
Pre-allocating slices really pays dividends when we create loads of
them and they don't grow very large.

We take special care to return nil rather than 0-length slices. This
a) saves further on allocation, and b) is required for some crude
tests to pass that match on nil rather than length.

Also, a bunch of code in templates/tables used slices as Maybe's,
i.e. returning nil or a single-element slice, which is horrendously
inefficient. Eliminating these saves a lot of allocations.
2017-12-25 12:33:43 +00:00
Matthias Radestock
78b9ac3cfc Merge pull request #3001 from weaveworks/fast-topology-lookup
make `Report.Topology(name)` fast
2017-12-25 09:46:35 +00:00
Matthias Radestock
dcda88471a get rid of report.Topologies()
The three report.Walk* functions are quite enough.
2017-12-24 22:30:20 +00:00
Matthias Radestock
e2eef50cda eliminate (out-of-date) list of topologies in plugin code 2017-12-24 22:27:02 +00:00
Matthias Radestock
9419c3ef5c refactor(ish): reduce number of topology lists
Having 6 lists of topolgies in the same file is a bit much:

1. consts for topology names
2. Report type definition
3. MakeReport() Report initialisation
4. Report.Topology(name) lookup
5. Report.TopologyMap() mapping of names to topology references
6. Report.WalkPairedTopologies() iterator over topology references

We get rid of 5 and 6 by introducing a topologyNames slice. So we
are down to 5.

We replace Report.TopologyMap() with a new function,
WalkNamedTopologies, that uses topologyNames. WalkPairedTopologies()
is updated to operate in a similar fashion. Likewise for
WalkTopologies() and Topologies() - these were previously calling
Walk[Paired]Topologies, but it is clearer to simply implement them
directly.
2017-12-24 22:26:57 +00:00
Matthias Radestock
583e81d733 make Report.Toplogy(name) fast
Previously this was buidling a fresh map of all topologies, just so it
could look up the one given as an argument.

Node summarisation (via detailed.Summaries) in particular was badly
affected by that.
2017-12-24 19:11:24 +00:00
Matthias Radestock
06c3cacfbe Merge pull request #3000 from weaveworks/benchmark-summary
benchmark report summarization
2017-12-24 10:32:45 +00:00
Matthias Radestock
b3d549ca9f Merge pull request #2999 from weaveworks/inline-some-summarisation
refactor: inline summarisation of metadata, metrics, tables
2017-12-24 10:30:36 +00:00
Matthias Radestock
f4668ca692 add benchmarks for report summarization
This is the last phase before result marshalling in the
/api/topology/{name} handler.
2017-12-24 09:48:41 +00:00