96 Commits

Author SHA1 Message Date
Tom Wilkie
8b424df2be Review feedback. 2015-09-16 09:29:42 +00:00
Tom Wilkie
fcb7c47bd9 Always include endpoint nodes brought in by procspy, even if they get merged with conntracked endpoints. 2015-09-16 03:46:15 +00:00
Tom Wilkie
7eeb768787 Nodes.Merge should Merge Node(s)! 2015-09-15 10:03:01 +00:00
Tom Wilkie
2f760f2f33 Cache generated ids to relieve pressure on the GC 2015-09-09 15:01:58 +00:00
Tom Wilkie
d411afd916 WithNode is a CPU hog. 2015-09-09 15:01:57 +00:00
Peter Bourgon
b143946db6 omitempty 2015-09-08 11:41:19 +02:00
Peter Bourgon
474525bcd6 Don't omit Node fields from JSON rendering 2015-09-08 10:47:40 +02:00
Peter Bourgon
7513b4e396 Wrap comments at 80col throughout the fileset 2015-09-07 10:36:35 +02:00
Alvaro Saurin
15e25edc40 New asynchronous, caching DNS resolver for reverse resolutions
Add nodes for the remote side of connections iff we have a DNS reverse resolution for the IP.
Unit test for the resolver
2015-09-04 17:21:45 +02:00
Tom Wilkie
57f7b4f2e6 Rename NodeMetadata -> Node 2015-09-03 16:18:54 +00:00
Tom Wilkie
d09a853fb2 Show container image details for containers. 2015-09-03 10:26:13 +00:00
Tom Wilkie
9ba38d71cc Review feedback 2015-09-03 10:19:27 +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
Tom Wilkie
afc2788777 Move EdgeMetadata into the NodeMetadata struct. 2015-09-02 14:32:44 +00:00
Tom Wilkie
e867d168e1 Typo 2015-09-01 12:59:26 +00:00
Tom Wilkie
899e2d7a5c Review feedback 2015-09-01 11:01:25 +00:00
Tom Wilkie
1f6b3d4a45 Move Adjacency info inside the NodeMetadata struct; move pseudo node generation to the probes. 2015-08-28 15:20:27 +00:00
Peter Bourgon
775f0ede90 render: fixes for new merge semantics 2015-08-26 12:02:11 +01:00
Peter Bourgon
42be036428 report: always copy 2015-08-25 17:52:20 +01:00
Peter Bourgon
b138dda3b3 Move merge functions with their types 2015-08-25 13:31:25 +01:00
Tom Wilkie
08e1090a65 Merge pull request #369 from weaveworks/336-show-counts
Show how many containers have been grouped together under an image
2015-08-19 15:42:00 +01:00
Tom Wilkie
7508df7e5b Add NodeMetadata.Counters with appropriate merge semantics 2015-08-19 14:24:21 +00:00
Tom Wilkie
60d1b503c1 Deal with directed edges in the rest of the codebase. 2015-08-19 10:17:31 +00:00
Tom Wilkie
89831bfdd2 Condense origin address entries into a single table. 2015-08-18 11:23:45 +00:00
Peter Bourgon
0dafad763f Calculate rates in detailed nodes 2015-08-03 16:04:06 +02:00
Peter Bourgon
e1f7752a34 Split PacketCount to Egress and Ingress
Also, 1 packet may be counted in N topologies, so you can't rely on the
sum of all packet counts across topologies having any relation to the
sampling data.
2015-08-03 14:58:41 +02:00
Peter Bourgon
0361b11b87 Fix bugs in how we report bandwidth 2015-08-03 12:25:56 +02:00
Peter Bourgon
0aadf6447b Revert to correct edge construction
Another implicit invariant in the data model is that edges are always of the
form (local -> remote). That is, the source of an edge must always be a node
that originates from within Scope's domain of visibility. This was evident by
the presence of ingress and egress fields in edge/aggregate metadata.

When building the sniffer, I accidentally and incorrectly violated this
invariant, by constructing distinct edges for (local -> remote) and (remote ->
local), and collapsing ingress and egress byte counts to a single scalar. I
experienced a variety of subtle undefined behavior as a result. See #339.

This change reverts to the old, correct methodology. Consequently the sniffer
needs to be able to find out which side of the sniffed packet is local v.
remote, and to do that it needs access to local networks. I moved the
discovery from the probe/host package into probe/main.go.

As part of that work I discovered that package report also maintains its own,
independent "cache" of local networks. Except it contains only the (optional)
Docker bridge network, if it's been populated by the probe, and it's only used
by the report.Make{Endpoint,Address}NodeID constructors to scope local
addresses. Normally, scoping happens during rendering, and only for pseudo
nodes -- see current LeafMap Render localNetworks. This is pretty convoluted
and should be either be made consistent or heavily commented.
2015-08-03 10:55:59 +02:00
Peter Bourgon
c7a06d2a43 Don't flat-embed sampling in the report
In the JSON representation, we want the Sampling data to be distinct.
2015-08-03 10:55:59 +02:00
Peter Bourgon
b9afa67ad6 gopacket-based traffic sniffing 2015-08-03 10:55:59 +02:00
Peter Bourgon
b3868c58d7 Fix a subtle bug in render mapping
During rendering, RenderableNodes are created by Map funcs, which take only
NodeMetadata. Previously, it was simply assumed that the relevant keys for a
given Map func would be present in the metadata. If that implicit invariant
failed, the returned RenderableNode would be invalid, with e.g. an ID of
"hostid::". That, in turn, would trigger undefined behavior later on in the
rendering workflow.

This bug was detected by creating a partial node metadata for a non-local
endpoint node. That node was detected during the first phase of rendering, and
given an invalid renderable node ID of "myhostname::", which prevented it from
attaching to TheInternet pseudonode. It eventually got removed from the  set
of valid nodes, which meant nodes that were adjacent to it suddenly became
orphans, and got filtered out by the FilterUnconnected step of the rendering
pipeline.

With this change, every map func checks for the presence of mandatory fields,
i.e. the fields that compose the resulting renderable node's ID.

Also,

- Add unit tests for LeafMapFuncs
- Topology Validate checks NodeMetadatas must not have nil Metadata
2015-08-03 10:43:07 +02:00
Peter Bourgon
3dd59c8b9b Fixes to NodeMetadata
NewNodeMetadata -> MakeNodeMetadata. It doesn't return a pointer, so
Make is more idiomatic.

Invoke MakeNodeMetadata when necessary. The zero value for a
NodeMetadata is no longer valid.

Split MakeNodeMetadata to two constructors. MakeNodeMetadata when you
don't have anything to prepopulate; MakeNodeMetadataWith when you do.

Also, a fix to the tests in app. We unmarshal a RenderableNode struct,
which has a JSON-ignored NodeMetadata field. The zero value is invalid,
so we need to fix that before performing comparisons.
2015-07-30 17:20:44 +02:00
Tom Wilkie
f85195308c report.Metadata -> map[string]string 2015-07-16 12:06:05 +00:00
Tom Wilkie
c2065836e2 Make NodeMetadata a struct, move existing map[string]string to NodeMetadata.Metadata 2015-07-15 10:06:36 +00:00
Bryan Boreham
1fa853befe Neater implementation of de-duplication in MakeIDList() 2015-07-08 13:38:39 +01:00
Bryan Boreham
35f9dc622e More efficient slice-insert - less copying, less garbage 2015-07-07 22:36:22 +01:00
Bryan Boreham
baf0d94af9 Implement a Merge function on IDLists which is more efficient than repeated Add 2015-07-07 22:36:22 +01:00
Bryan Boreham
76d658b193 Make MakeIDList() enforce invariant 2015-07-07 22:16:50 +01:00
Paul Bellamy
95f941ff2d const-izing NodeMetadata fields 2015-07-02 14:51:12 +01:00
Paul Bellamy
cd71f82d4d aggregate connection details table
List Local and Remote endpoints for each TCP connection on the node.
2015-07-02 14:21:16 +01:00
Peter Bourgon
90a0286909 Refactor tests to have appropriate packages
By default, tests should be in package pkg_test. If they need to test
package internals, they can be in package pkg, but then should carry a
suffix of foo_internal_test.go.

This changeset enforces that idiom across the codebase, and adds a check
to the linter to make sure it remains.

Also, some fixes to comments.
2015-06-29 18:06:44 +02:00
Tom Wilkie
416f56c3cc Only have a single report fixture
- Move render.Rpt to test.Report
- Remove report/report_fixture_test.go; it was unused
- Remove report fixture in app/ and make tests use test.Report
- Move expected outputs into render/expected, so they can be reused
2015-06-24 09:51:29 +00:00
Tom Wilkie
152774a812 Extract out rendered node id generation into a small set of functions. 2015-06-23 07:42:17 +00:00
Tom Wilkie
82a7f93e17 Treat addresses on the docker bridge as local. 2015-06-22 11:24:47 +00:00
Tom Wilkie
49dae07cca Make render module produce The Internet pseudo node. 2015-06-19 11:09:52 +00:00
Tom Wilkie
f32d2b5a5e Remove report squash logic. 2015-06-18 17:20:20 +00:00
Tom Wilkie
25ca0c0eb7 Add ContainerImage topology and use it to build the Container By Image graph.
This makes container image details show the containers (and processes) correctly.

Also:
- introduces a 'test' package, moved Diff function there.
- adds some tests for this new rendered view.
2015-06-18 09:16:20 +00:00
Tom Wilkie
f971ac12bf Move AggregateMetadata into render package. 2015-06-17 19:26:13 +00:00
Tom Wilkie
18c544701a Review feedback 2015-06-17 17:23:33 +00:00