Commit Graph

465 Commits

Author SHA1 Message Date
Matthias Radestock
d4d3e5f184 correct comment 2017-07-04 20:37:55 +01:00
Matthias Radestock
f0ae2bd98c refactor: use inline StringSet constructor 2017-07-04 06:29:19 +01:00
Matthias Radestock
1f023890e4 refactor: optimise report.Map.Render() 2017-07-03 07:54:32 +01:00
Matthias Radestock
7119fb9de8 refactor: rename report.NewNetworks to MakeNetworks
for consistency - all the other report set constructors are called
'Make...'
2017-07-03 01:26:22 +01:00
Matthias Radestock
9dc50b5202 refactor: hide "empty set" constants
They are an implementation detail.
2017-07-03 01:26:22 +01:00
Matthias Radestock
c5b2c9dc3d Merge pull request #2668 from weaveworks/2665-connection-pid-attribution
ignore endpoints with >1 adjacency in process rendering

This eliminates the worst effects of #2665.
2017-06-30 13:10:10 +01:00
Matthias Radestock
708931f98a ignore endpoints with >1 adjacency in process rendering
This eliminates the worst effects of #2665.
2017-06-29 22:34:05 +01:00
Mike Lang
ef2b6f6c55 Remove replica sets
Use a special kind of selector renderer to elide replica sets from pod nodes
and directly reference deployment parents instead.
Do the inverse (replace replica sets with pods) during the mapping from pod to deployment.

Note we can no longer use renderParents since we're using a non-standard Selector
2017-06-29 10:13:15 -07:00
Matthias Radestock
3209d65d52 filter out unconnected pseudo nodes on the outside
The change is necessitated by the removal of procspied/ebpf endpoint
filtering in the renderers, as a result of which the odd
conntracked-only, unconnected pseudo node can sneak through.

This new way of doing things also makes renderers more composable and
robust, and more directly reflects the objective:
- in the process topologies, filter out all unconnected nodes
- in all other topologies, filter out unconnected pseudo nodes
2017-06-27 20:28:30 +01:00
Matthias Radestock
e5a04ec5a4 do not filter endpoints by procspied/ebpf in renderers
The filtering of endpoints causes some connections to get missed for
non-eBPF-tracked connections. Furthermore, the filtering of endpoints
is entirely pointless when the probes run eBPF since the filters just
pass through eBPF-tracked endpoints (for good reason too; because
otherwise some connections would be missed). So in that case it is
just costing CPU and removing it actually improves performance.

Note that removing the filtering does not result in over-counting
connections since that is done by source ip:port pairs.

Fixes #2551.
Fixes #2558.
2017-06-27 20:28:13 +01:00
Mike Lang
f7913ab550 Rewrite renderers for k8s/ecs/swarm to abstract common parts
Since all the renderers were doing almost-exactly the same thing, we abstract that out into a common function.
2017-06-27 10:19:04 -07:00
Mike Lang
f101f83c3d controllers topology: Map metrics for single nodes
* Maps metrics if there is a single pod in the controller, as per all other views.
* Also added heavy commenting on the increasingly-complex render chain
2017-06-27 10:19:04 -07:00
Mike Lang
8eb72cf276 Remove deployment and daemonset views, change combined to controllers and remove bare pods and replica sets
Since we still need to map through replica sets to find matching deployments, we simply filter them out as a post-step.
2017-06-27 10:19:04 -07:00
Mike Lang
889972c48a Display node type on k8s controller nodes
Since there are multiple types in the same topology, displaying the type is important.
We do this in multiple places:

* Add node type to minor label

* Add node type as metadata and include in metadata template.
  Even though this will always be the same for every node of that topology, this was
  the easiest way to add it so it displays in the table view.
  Note we can't control ordering of columns in table view, it's always alphabetical.
2017-06-27 10:19:04 -07:00
Mike Lang
13b2ed69bd Improve renderer for combined view by refactoring Map2Parent
The existing technique of "reducing" the two rendered graphs for daemonsets and deployments
had a glaring issue that no connections would ever be made between nodes of different types,
since that information would've been discarded earlier in the process.
It also makes it hard to identify "parentless" pods.

This commit extends the Map2Parent function, teaching it:
	* To check multiple topologies for parents
	* To pass through nodes with no parents found without modification

Since we already had two 'modes' for what to do with nodes without parents,
and it would've been clunky to try to encode the third option into the existing PseudoNodeID
arg in some way, we instead split it into two args, with the first being an enum specifying
either the old pseudo node behaviour, the old drop behaviour, or the new keep behaviour.

We then use the new Map2Parent to map pods to:
	* A replica set, if it has one
	* A daemonset, if it has one
	* Itself, if neither of the above
and then map again from the results to any deployment, leaving as-is any nodes that
don't map to a deployment. Hence we are left with:
	* Deployments
	* Daemonsets
	* Replica sets, but only if they map to no deployment
	* Pods, but only if they map to none of the above
and connections between all these will be calculated correctly.
2017-06-27 10:19:04 -07:00
Mike Lang
d0cbf47c1c Add an option group to Combined view to select group type (daemonset or deployment)
This is a union set, so it will be suitable even as we continue to add more node types to this view.
2017-06-27 10:19:04 -07:00
Mike Lang
6dae014352 Add new view for 'combined' daemonset/deployment view
The idea is that this view shows all 'pods or groups of pods' at 'the highest level of abstraction'.
For now, we just show daemonsets and deployments.
2017-06-27 10:19:04 -07:00
Matthias Radestock
d66b28de2a performance: only color connected once
ProcessRenderer was coloring connected nodes because we need that info
for rendering details panels. However, the main process topology view
renderers depending on ProcessRenderer were also doing coloring
themselves. For the 'processes' topology that was literally
duplicating work. For the 'processes-by-name' topology that was
throwing away the process coloring, and then coloring at the name
level.

Solution: remove the coloring from the ProcessRenderer, thus
eliminating the duplicate/thrown-away work, and introduce a
ColorConnectedProcessRenderer which is only used in places that
populate details panels.
2017-06-22 10:28:39 +01:00
Matthias Radestock
8c6a171553 refactor: extract a couple of heavily used constants 2017-06-21 21:12:55 +01:00
Matthias Radestock
ae2a5edc18 make nodeSummaryGroupSpecs only include what's needed 2017-06-21 18:24:14 +01:00
Matthias Radestock
b6c886e0d1 cosmetic 2017-06-21 18:19:10 +01:00
Matthias Radestock
a306867610 fast network membership check
The rendering code checks whether endpoint IPs are part of
cluster-local networks. Due to the prevalence of endpoints - medium
sized reports can contain many thousands of endpoints - this is
performance critical. Alas the existing code performs the check via a
linear scan of a list of networks. That is slow when there are more
than a few, which will be the case in the context of k8s, since there
the probes register service IPs as local /32 networks.

Here we change representation of the set of networks to a prefix
tree (aka trie), which is well-suited for IP network membership checks
since networks are in fact a bitstring prefixes.

The specific representation is a crit-bit tree, but that choice was
purely based on implementation convenience - the chosen library is the
only one I could find that directly supports IP networks.
2017-06-21 03:03:49 +01:00
Matthias Radestock
9e75331e9a Revert "fast network membership check"
This reverts commit 98f036359b.
2017-06-20 20:51:27 +01:00
Matthias Radestock
98f036359b fast network membership check
The rendering code checks whether endpoint IPs are part of
cluster-local networks. Due to the prevalence of endpoints - medium
sized reports can contain many thousands of endpoints - this is
performance critical. Alas the existing code performs the check via a
linear scan of a list of networks. That is slow when there are more
than a few. Unfortunately in some common k8s network setups, e.g. on
AWS, a cluster can contain hundreds of networks, due to /32 networks
derived from interfaces with multiple IPs.

Here we change representation of the set of networks to a prefix
tree (aka trie), which is well-suited for IP network membership checks
since networks are in fact a bitstring prefixes.

The specific representation is a crit-bit tree, but that choice was
purely based on implementation convenience - the chosen library is the
only one I could find that directly supports IP networks.
2017-06-20 19:31:11 +01:00
Matthias Radestock
873fac12ac memoize isKnownServices for improved performance 2017-06-19 13:29:43 +01:00
Matthias Radestock
0d0414d348 faster matching of known services
We hit this code *a lot* during rendering.
2017-06-18 16:02:34 +01:00
Mike Lang
f403d01885 Forgot to include daemonsets in renderKubernetesTopologies
Yay, needing to remember 10 different obscure places to add a new topology every time.
2017-06-12 10:13:54 -07:00
Matthias Radestock
afbc1decab drop addr and port from Endpoint.Latest map
the information is constant and already present in the id, so we can
extract it from there.

That reduces the report size and improves report encoding/decoding
performance. It should reduce memory usage too and improve report
merging performance too.

NB: Probes with this change are incompatible with old apps.
2017-06-10 19:19:56 +01:00
Matthias Radestock
912c684e65 optimise memoisation for parallel execution
don't start the same piece of work twice
2017-06-05 10:30:11 +01:00
Matthias Radestock
91d3497f7d parallelise 'reduce' 2017-06-05 08:44:17 +01:00
Matthias Radestock
6eaffb44e0 fix bug: handle short-lived ebpf-tracked connections again
This got broken in #2559.

The problem here is similar to #2551.
2017-06-04 18:42:54 +01:00
Matthias Radestock
30c38a958f remove blatant falsehoods from comments 2017-06-04 16:23:03 +01:00
Matthias Radestock
ebcf9dcf10 refactor: rename ShortLivedConnectionJoin to ConnectionJoin
since it's dealing with *all* connections, not just short-lived ones.
2017-06-04 16:10:21 +01:00
Matthias Radestock
9bc7b30f0f extract and expand endpoint procspied filter
The filter needs to exclude both procspied and eBPF-tracked endpoints,
since both will be picked up by the process topology.
2017-06-04 16:10:21 +01:00
Matthias Radestock
707add13a3 refactor: simplify some filters 2017-06-04 16:10:21 +01:00
Matthias Radestock
ee0736df69 refactor: extract constant mapEndpoint2IP 2017-06-04 16:10:21 +01:00
Matthias Radestock
6697f4a897 refactor: declosure ShortLivedConnectionJoin 2017-06-04 16:10:21 +01:00
Matthias Radestock
ff4a4c08ce refactor: remove pointless optimisation 2017-06-04 10:36:55 +01:00
Mike Lang
3aa4a676dd Add new view for daemonsets 2017-05-19 15:06:53 -07:00
Mike Lang
c60731b043 Add report topology for daemonsets 2017-05-19 15:00:01 -07:00
preston_doster_tc
ed9c369f50 Standardized formatting. 2017-05-15 15:27:48 -05:00
preston_doster_tc
0f1c2f1cb7 Corrected spacing. 2017-05-15 13:32:39 -05:00
preston_doster_tc
df58f55782 Added Azure endpoints so they show up as individual nodes instead of under 'The Internet'. 2017-05-15 13:27:06 -05:00
Mike Lang
51999529a7 Add docker swarm Stack selector ala k8s namespace selector
We have to introduce the kinda hacky concept of a 'No Stack' stack
to reconcile it with the idea of a 'default' k8s namespace. This is important
because swarm services without a stack don't have the same docker labels as ones that do.
Curiously, they still have what appears to be a stack name 'prefix' on their names,
but I can't isolate that name anywhere easily so they'll just have to make do.

I basically copy-pasted updateFilters to make this work, todo go back and refactor
to not duplicate 90% of the code.
2017-04-18 09:08:22 -07:00
Mike Lang
2b208580ab Add new topology view for Docker Swarm services 2017-04-14 17:18:06 -07:00
Mike Lang
9f0f120bc5 Remove explicit listing of api topologies in render/detailed/node specs
Instead, we can infer them from the render topology and the primaryAPITopology map
2017-04-10 15:06:38 -07:00
Mike Lang
3656965ae7 Refactor Map2Parent and family into one function
This greatly improves code reuse while keeping the behaviour flexible
2017-04-10 14:30:53 -07:00
Mike Lang
9c88ad85e9 render/detailed/parents: Refactor for less repeated information
We replace the existing data structure with a simpler one that
only specifies how to get the parent label, which is the only
part of the Parent struct that can't be generated from the node info alone.

Future work: Standardize this concept of a label and put it in the topology instead.
Though that already exists...so just use it?
2017-04-10 14:30:52 -07:00
Mike Lang
2a74883cce If no node summary generator exists for topology, do a sane default
The default sets the node label to the node ID.
This is likely to not look very good, but the intent is that it creates an obvious problem,
ie. that the node ID is being used as the label, rather than a silent omission or more subtle problem.

Possible future work:
* For single-component IDs, extract the component automatically and use that instead.
* Instead of functions, in simple cases just have a LUT by topology with common behaviours like
  'stack = true or false', 'label = this key in node.Latest'
The latter opens up to eventually moving this info inside the report itself ala topology templates,
or at least centralizing it in the source.
2017-04-10 14:30:52 -07:00
Mike Lang
c16becc148 render/detailed: When summarising children, add fallback for unlisted topologies
Currently, if a topology does not have any specific info in nodeSummariesByID,
any children of the node that belong to that topology will be silently omitted.

This change adds a default behaviour for such topologies, with no special columns
but at least it is displayed at all.
Unlisted topologies are displayed after all listed ones, in arbitrary order.

Note that completely bogus or other special cases (eg. topology = Pseudo) still will not
be displayed as report.Topology() will fail.
2017-04-10 14:30:52 -07:00