Commit Graph

534 Commits

Author SHA1 Message Date
Matthias Radestock
1c39d14c74 make render.ResetCache() reset all caches
so that benchmarks yield more consistent results.
2017-11-22 13:00:39 +00:00
Matthias Radestock
1c206fb1c9 cosmetic: bring comment up to date 2017-11-22 10:40:34 +00:00
Bryan Boreham
5697d53034 Rewrite MapX2Host as a RenderFunc using joinResults
It's more efficient as many input Nodes map onto a few hosts.
2017-11-22 10:39:37 +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
f56a44e67d cosmetic: move a function 2017-11-22 09:46:33 +00:00
Matthias Radestock
334dba20e7 cosmetic: move some functions 2017-11-22 09:19:10 +00:00
Matthias Radestock
b24334c246 fix small bug in Filtered calculation
Filtering nodes *adds* to the Filtered count.
2017-11-22 09:13:23 +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
e643ec56be refactor: move filter logic to FilterFunc
so it becomes accessible w/o having to construct a Filter renderer.
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
093857f37f refactor: extract a little test helper 2017-11-21 20:13:14 +00:00
Matthias Radestock
67950985ef refactor: introduce IsConnected FilterFunc
and rename existing IsConnected const to IsConnectedMark
2017-11-20 09:28:56 +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
Bryan Boreham
b9890064c2 Copy net.ParseIP and modify to save memory allocations
Pass in a slice on the stack instead of allocating one on the heap:
reduces garbage, hence makes the program run faster

Also apply knowledge that critbitgo will do an append() with one extra
byte, so we do that allocation up-front too.  This is innocuous should
we stop using critbitgo or should its internals change.
2017-11-15 23:15:55 +00:00
Matthias Radestock
21a91fe9dd remove HostRenderer memoisation
since it was only introduced to because producing stats would hit the
renderer twice, which is no longer the case.
2017-11-08 07:15:28 +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
917ef980a4 Memoise HostRenderer
This shows a big improvement in BenchmarkTopologyList
2017-11-07 10:18:27 +00:00
Bryan Boreham
ec0689b5aa Code review: improve consistency of naming and ordering 2017-11-06 22:12:13 +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
Bryan Boreham
cbba3c0fd3 Clarify use of 'id' in addToResults
Pass 'id' through to the create function and expect that the result Node has that ID.
Extract a function newPseudoNode for common calls.
2017-11-06 22:12:13 +00:00
Bryan Boreham
322aa76e02 Remove functions which are no longer called 2017-11-06 22:12:10 +00:00
Bryan Boreham
cbcb5f19fc Rewrite ProcessRenderer/MapEndpoint2Process as a single Renderer
This is much more efficient as we skip creating then merging all intermediate Nodes
2017-11-06 22:06:29 +00:00
Bryan Boreham
77a8cac65a Use helper to add result nodes in endpoints2Hosts.Render
This means we are no longer generating a Counter for the number of
endpoint sub-nodes, but it seems that data was not used.
2017-11-06 22:05:05 +00:00
Bryan Boreham
e16aaf6c43 Merge nodeToIP, endpoints2Nodes and ipToNode into one Renderer
This is much more efficient as we skip creating then merging all intermediate Nodes
2017-11-06 22:05:05 +00:00
Bryan Boreham
b684e3c6fc Rewrite MapEndpoint2Host as a Renderer
This allows us to avoid creating a host of 'IP' type Nodes then
discarding them after matching; instead we match directly and create
just the result we want.
2017-11-06 22:05:05 +00:00
Bryan Boreham
1b3e40ccb5 Refactor: extract pseudoNodeID function 2017-11-06 22:04:59 +00:00
Bryan Boreham
d230846b95 Refactor: extract externalNodeID function 2017-11-06 20:55:57 +00:00
Filip Barl
119bbab4fe Merge pull request #2915 from weaveworks/2875-humanize-durations
Humanize reported durations
2017-11-06 14:11:45 +01:00
Matthias Radestock
b3669bee84 Merge pull request #2924 from weaveworks/2923-memoise-less
remove unused memoisation

Fixes #2923
2017-11-06 10:35:22 +00:00
Matthias Radestock
7b0a08ae9d memoise renderer passed to ConnectionJoin
We do this here rather than in ConnectionJoin since that way it is
obvious that the renderer isn't memoised already.
2017-11-05 11:05:28 +00:00
Matthias Radestock
5f4f9da4df memoise a few more shared renderers 2017-11-05 00:21:45 +00:00
Matthias Radestock
b793a9efa8 memoise shared top-level renderers
and add a comment indicating non-memoisation of other, not shared
top-level renderers.

This memoisation is effective when the browser requests multiple
topologies for the same report.
2017-11-04 23:05:52 +00:00
Matthias Radestock
2bdab7513e ditch all memoisation
we will re-introduce it more selectively later
2017-11-04 22:21:50 +00:00
Bryan Boreham
800979a089 Avoid object creation when scanning DNS names
Since we do this a lot, scanning the lists in-place saves time.
Also we don't need to sort them since StringSet is implemented as a
sorted set of strings
2017-11-04 17:37:04 +00:00
Filip Barl
320b9e240f Abstracted the report data types. 2017-11-03 10:43:41 +01:00
Matthias Radestock
86292acf47 micro refactor: save a line, narrow scope 2017-08-18 19:28:36 +01:00
Matthias Radestock
7520713dc4 refactor: reduce duplication in links_test 2017-08-16 17:28:14 +01:00
Roland Schilter
f26c875c4c Filter by namespace in metric queries (#2819)
And get rid of B -> MB conversion

Fixes #2817
2017-08-16 17:08:51 +01:00
Roland Schilter
b69ce340f8 scope/cortex: fix typo in query filter (#2815)
* scope/cortex: fix typo in query

* Get rid of the "controllers" code

They do not all share the same queries.
2017-08-16 10:46:49 +01:00
Roland Schilter
0d381a34d6 Link scope-ui graphs clickable to prometheus queries (#2664)
scope-app:
* Adds `-app.metrics-graph` cli flag for configuring the base url to
use for graph links; supports :orgID and :query placeholders
* Assigns query URLs to existing metrics and appends empty metrics if missing

scope-ui:
* Extends <CloudFeature /> with option alwaysShow
* Adds <CloudLink /> to simplify routing when in cloud vs not in cloud
* Links metric graphs in the ui's node details view for all k8s
toplogies and containers so far
* Tracks metric graph click in mixpanel `scope.node.metric.click`
* Uses percentages and MB for CPU/Memory urls
* Passes timetravel timestamp to cortex in deeplink
2017-08-15 18:56:23 +01:00
Matthias Radestock
65cebed6c4 get rid of endpoint type indicators
The app stopped paying attention to these some time ago.

Removing them shrinks reports by 3-10%.
2017-07-30 08:38:56 +01:00
Mike Lang
486bdcc796 k8s: Use 'DaemonSet', 'StatefulSet' etc instead of 'Daemon Set', 'Stateful Set'
We can't search for terms with spaces.
2017-07-26 13:49:54 -07:00
Mike Lang
4d2b4541c9 Merge pull request #2724 from weaveworks/mike/k8s/jobs-and-petsets
kubernetes: Add StatefulSets and CronJobs
2017-07-19 16:27:53 -07:00
Mike Lang
ac96738ad0 render: In minor labels, display '0 things' instead of blank if zero things present
This also fixes a bug where k8s controller nodes would show up as 'Deployment of' without any number
2017-07-18 11:44:51 -07:00
Mike Lang
17fffb32e1 Add stateful sets and cronjobs to Controllers renderer
Since renderKubernetesTopologies was getting unweildy, refactored into a form
which was a bit clearer, if a bit more verbose.
2017-07-18 11:35:50 -07:00
Mike Lang
9fb6c46467 Add report topologies for Stateful Sets, Cron Jobs 2017-07-18 11:35:50 -07:00