Commit Graph

4574 Commits

Author SHA1 Message Date
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
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
Matthias Radestock
06e0bed015 refactor: extract helper for rendering a topology 2017-12-24 09:44:48 +00:00
Matthias Radestock
6784d95ac8 refactor: extract getting report for benchmarking 2017-12-24 09:18:20 +00:00
Matthias Radestock
d4d7764311 cosmetic(ish) 2017-12-24 09:13:22 +00:00
Matthias Radestock
bf14b3dafd upgrade reports we merge / render
This better reflects what the app is doing.
2017-12-24 08:55:45 +00:00
Matthias Radestock
615cb6af59 simplify error handling 2017-12-24 08:43:24 +00:00
Matthias Radestock
794c345aee cosmetic: more logical function order 2017-12-24 08:33:13 +00:00
Matthias Radestock
49e4c7b0b6 make report upgrade benchmark reflect new phasing
Since #2979 upgrading happens prior to merging.
2017-12-24 08:29:37 +00:00
Matthias Radestock
43fadceb85 cosmetic: better function grouping 2017-12-24 08:18:12 +00:00
Matthias Radestock
ad72a2cf2f refactor: rename topology rendering benchmarks 2017-12-24 08:16:57 +00:00
Matthias Radestock
fc66827af7 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-23 22:39:08 +00:00
Matthias Radestock
d861b41837 refactor: inline summarisation of metadata, metrics, tables
This removes a bunch of duplication and scattering of little pieces of
code.
2017-12-23 22:34:45 +00:00
Matthias Radestock
651e42e54e fix accidental report fixture modification
Report.Copy() shallow-copies the nodes in Report.Nodes. Hence
Node.Metrics is shared between the original and the copy. Hence bad
things happen when modifying it.

This bug has laid dormant because by luck other tests in detailed_test
involving metrics are executed first.
2017-12-23 22:21:24 +00:00
Bryan Boreham
9c01613db1 Merge pull request #2993 from weaveworks/golang-1-9-2
Upgrade Go to 1.9.2
2017-12-21 22:53:41 +00:00
Matthias Radestock
7459014c63 Merge pull request #2997 from weaveworks/no-image-host-propagation
don't map image adjacencies to hosts
2017-12-21 10:08:37 +00:00
Matthias Radestock
724ea0c230 refactor: extract common code of joinResults.addChild variants 2017-12-21 10:05:56 +00:00
Matthias Radestock
9713a156c7 refactor: extract helper 2017-12-21 10:05:56 +00:00
Matthias Radestock
7d261d0ca0 don't map image adjacencies to hosts
it's just wrong
2017-12-21 10:05:56 +00:00
Matthias Radestock
dd2dfd54f5 Merge pull request #2996 from weaveworks/multi-join
cope with one->many topology mappings
2017-12-20 11:38:24 +00:00