Commit Graph

76 Commits

Author SHA1 Message Date
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
724ea0c230 refactor: extract common code of joinResults.addChild variants 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
ee4a56e8ad optimse common one->one mapping case
one->many is much rarer
2017-12-19 19:34:52 +00:00
Matthias Radestock
25eeec0227 enhance joinResult to handle mapping one node to multiple nodes 2017-12-18 21:13:15 +00:00
Matthias Radestock
f920f1b9d2 refactor: extract helper to add joinResult mapping 2017-12-18 18:41:52 +00:00
Matthias Radestock
ba7af78cfa ensure result adjacencies start empty
Any existing list would be mutated by result(), which is bad.

Note that all the existing newJoinResults() call sites pass in nodes
with no adjacencies, so this is purely a safety measure.
2017-12-17 18:24:32 +00:00
Matthias Radestock
ac87c2b6e8 optimise & simplify node propagation in joinResult
Instead of copying unmatched nodes at the end, and matched nodes when
we encounter them, copy *all* nodes at the beginning.
2017-12-17 18:14:48 +00:00
Matthias Radestock
f16908aea9 refactor: fix up adjacencies as part of joinResult.result() 2017-12-17 18:14:47 +00:00
Matthias Radestock
0c894e9446 refactor: drop networks from render.MapFunc
All the MapFuncs that needed networks have been elevated to Renderers.
2017-12-17 00:18:12 +00:00
Matthias Radestock
7bbded9e84 refactor(ish): introduce Tranformers
so we can generalise the filter step in render.Render et al. That will
allow us to apply whole-topology filters in that step.
2017-11-28 06:54:15 +00:00
Matthias Radestock
be8801ab92 optimisation: faster knownServiceCache
We use an LRU cache implementation that is keyed on strings, which
avoids conversion to/from interface and the memory allocation that
entails.
2017-11-25 19:33:49 +00:00
Matthias Radestock
1c39d14c74 make render.ResetCache() reset all caches
so that benchmarks yield more consistent results.
2017-11-22 13:00:39 +00:00
Bryan Boreham
3e62f7b754 Rewrite MapProcess2Name to process all nodes in one pass
This is more efficient as there are typically many fewer names than
processes.
2017-11-22 10:33:00 +00:00
Matthias Radestock
346a0360ef Refactor: split addToResults into two functions
This is preparatory to future refactorings: all existing calls are to
Endpoints which have no children and where we don't want a Counter.

We make addChildAndChildren an obvious extension of addChild even
though it adds a dead code path (we never call addChildAndChildren
with an endpoint).
2017-11-22 10:30:18 +00:00
Matthias Radestock
0c43526465 refactor: use new FilterFunc.Apply
instead of constructing temporary Filter renderers.

This also makes clearer what is going on.
2017-11-21 20:16:59 +00:00
Matthias Radestock
88e8b52d66 Decorators, begone!
Decorators were just a complicated way of constructing filters.
2017-11-21 20:16:30 +00:00
Matthias Radestock
ae153e57f5 refactor: remove Decorator from render.Renderer.Render() signature 2017-11-18 18:04:52 +00:00
Matthias Radestock
a82d245e93 simplify render decoration
Decoration is in fact quite a simple process that is applied on entry
to rendering: we take a base renderer, transform it with a decorator,
and then render a report with it. The new render.Decorate() function
does exactly that.

There is one exception. When rendering an individual node, e.g. for
showing its details panel in the UI, we must not lose the node during
decoration. That requires some special logic, which previously resided
in the PreciousNodeRenderer, and now lives in handleNode.
2017-11-18 18:04:52 +00:00
Matthias Radestock
aaf4e54df2 pass render filters and maps by value rather than reference
They are small and don't carry mutable state, so there is no point
passing them by reference.
2017-11-18 12:10:00 +00:00
Matthias Radestock
9bd8bd825b remove now superfluous Renderer.Stats method
step 2 (and final step) in producing stats as part of Rendering
2017-11-08 07:15:28 +00:00
Matthias Radestock
8f7e00f46a Stats are easily produced as part of Rendering
...so there is no need for a separate Stats method.

step 1: return stats from Render
2017-11-08 07:15:28 +00:00
Bryan Boreham
4feb451760 Refactor join-Renderer helper functions as methods
New type joinResult is created to hold the nodes and ID mapping.
The implementation move from host.go to render.go.
2017-11-06 22:12:13 +00:00
Matthias Radestock
2bdab7513e ditch all memoisation
we will re-introduce it more selectively later
2017-11-04 22:21:50 +00:00
Matthias Radestock
86292acf47 micro refactor: save a line, narrow scope 2017-08-18 19:28:36 +01:00
Matthias Radestock
1f023890e4 refactor: optimise report.Map.Render() 2017-07-03 07:54:32 +01:00
Matthias Radestock
91d3497f7d parallelise 'reduce' 2017-06-05 08:44:17 +01:00
Filip Barl
2e9255b190 Addressed the comments and fixed the tests. 2017-02-20 11:40:40 +01:00
Alfonso Acosta
5eabf5436c Make linter happy 2016-10-05 13:07:17 +00:00
Alfonso Acosta
3f27d5f6cc Do not filter out the target nodes when obtaining the details panel 2016-10-05 12:22:50 +00:00
Tom Wilkie
57618be932 Add a condition to rendering any kubernetes nodes at all 2016-05-03 17:05:44 +01:00
Tom Wilkie
9eaac25d69 Don't merge nodes in the rendering pipeline 2016-05-03 15:18:31 +01:00
Tom Wilkie
b4a59f6e36 Don't recursively gets stats beyond an ApplyDecorators decorator 2016-04-29 12:06:33 +01:00
Paul Bellamy
3d3aed2bb3 Fixing grouped node count for filtered children nodes
Squash of:

* We have to keep all the container hostnames until the end so we can
  count how many we've filtered

* Adding tests for ContainerHostnameRenderer and PodServiceRenderer with
  filters

* Because we filter on image name we need the image name before
  filtering

* Alternative approach to passing decorators.

* Refactor out some of the decorator capture

* Don't memoise decorated calls to Render

* Fixing filtered counts on containers topology

  Tricky, because we need the filters to be silent sometimes (when they're
  in the middle), but not when they're at the top, so we take the "top"
  filter's stats. However, this means we have to compose all
  user-specified filters into a single Filter layer, so we can get all
  stats.

  There are no more Silent filters, as all filters are silent (unless they
  are at the top).

  Additionally, I clarified some of the filters as their usage/terminology
  was inconsistent and confused. Now Filter(IsFoo, ...) *keeps* only nodes
  where IsFoo is true.
2016-04-28 12:23:43 +01:00
Tom Wilkie
22e8418e7a Reorganise the render/ package 2016-04-22 11:07:07 +01:00
Paul Bellamy
2c6b6e6707 Refactoring rendering to remove RenderableNode
Squash of:
- use detailed.Summaries to render topology nodes
- ban merging nodes of different topologies (they should be mapped)
- need to prune parents when mapping node types
- render container images by id if they have no name
- remove separate render ids and prune parents in NewDerived*
- don't render metrics/metadata for groups of nodes
- fixing up tests
- removing pending unit tests (for mapping.go, for now)
- updating experimental dir for RenderableNode removal
2016-03-29 14:13:03 +01:00
Paul Bellamy
94d52f02a7 Refactored render/memoise and added a basic test for it 2016-01-27 16:29:55 +00:00
Tom Wilkie
0e3e3b74f8 Add benchmark for list topologies API. 2016-01-25 21:48:18 -08:00
Tom Wilkie
b1a3a15ac0 A more debugging 2016-01-25 14:23:39 -08:00
Tom Wilkie
f8cbaf0794 Flush cache between runs of the benchmark. 2016-01-25 13:53:38 -08:00
Tom Wilkie
b8daa02488 Memoise & cache the result of renderers, so we don't recalculate views multiple times. 2016-01-25 13:31:10 -08:00
Paul Bellamy
9bd818174c Removing dead EdgeMetadata rendering code 2015-12-07 15:34:01 +00:00
Tom Wilkie
8f957c4f13 Add docker lifecycle controls, containers in states other that running, and a filter for those containers.
Also add integration test for container controls.
2015-11-06 17:39:54 +00:00
Paul Bellamy
be1d1d52d0 Basic Kubernetes integration
* Added helper for installing scope on gcloud
* Added topologies Pods and Pods-by-Service
* Uses k8s.io/kubernetes/pkg/client/cache for the client
* Filter kube-system nodes by default
* Only show the k8s topologies if we've received a non-empty k8s report
2015-10-06 12:55:51 +01:00
Tom Wilkie
5c0555ae39 Report number of filtered nodes in topology stats.
Include filtered psuedo nodes in stats.
2015-09-29 08:51:38 +00:00
Tom Wilkie
9e72ef1a1f Remove pseudo nodes that are made unconnected by filtering. 2015-09-23 07:02:55 +00:00
Peter Bourgon
1dfc725706 Filter system containers from topologies; add API to control filters. 2015-09-07 14:24:15 +00:00
Tom Wilkie
57f7b4f2e6 Rename NodeMetadata -> Node 2015-09-03 16:18:54 +00:00
Tom Wilkie
21675f3000 Remove LeafMap - have a generic function which converts a Topology to a RenderableNodes. 2015-09-02 15:03:57 +00:00
Tom Wilkie
144a798602 Review Feedback 2015-09-02 14:32:47 +00:00