Commit Graph

78 Commits

Author SHA1 Message Date
Peter Bourgon
43bfecbba4 Add X-Scope-Probe-ID header to POSTs 2015-08-13 13:01:58 +02:00
Peter Bourgon
7d51f173ea Probes POST to apps
- App takes POST report on /api/report
- Probe publishes to configured target(s)
- Name resolution happens on probe-side
- There's no longer an xfer.ProbePort
- xfer.Collector responsibility is reduced
- Fixes to remaining experimental components.
- rm experimental/bridge: it's not being used, and by changing the
  app/probe comm model, it would require a complete refactor anyway. We
  can easily rebuild it when we need to. It will even be much simpler.
- rm experimental/graphviz: it's broken for some time anyway, and we
  don't really need to play around with it as a rendering option
  anymore.
- rm experimental/oneshot: we never use this anymore.
2015-08-07 15:45:15 +02:00
Peter Bourgon
3069ce01e0 Fix lockup bug on Linux 2015-08-04 12:15:15 +02: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
64ebedccb1 Allow packet capture with effective sample rate 100% 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
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
Peter Bourgon
70ffde9de3 Merge pull request #333 from weaveworks/consistent-variable-naming
Fix some variable names
2015-07-30 17:04:46 +02:00
Peter Bourgon
fc308d93b8 Normalize var names; use Addr/Port key constants 2015-07-30 16:36:27 +02:00
Peter Bourgon
70f8c62415 Don't panic tests on Darwin.
Use the proper DialStub in the container setup.

Also, one change to increase test coverage.
2015-07-30 15:16:26 +02:00
Peter Bourgon
fb7eed103e Merge pull request #320 from weaveworks/process-names-on-darwin
Naïve process walker for Darwin
2015-07-20 16:37:25 +01:00
Tom Wilkie
f85195308c report.Metadata -> map[string]string 2015-07-16 12:06:05 +00:00
Peter Bourgon
b585a362ac Naïve process walker for Darwin
This fixes the regression where process names weren't appearing for
Darwin probes. Makes testing easier.

Also, changes the process walker to operate on value types. There's no
performance advantage to using reference types for something of this
size, and there appeared to be a data race in the Darwin port that
caused nodes to gain and lose process names over time.

Also, restructures how to enable docker scraping. Default false when run
manually, and enabled via --probe.docker true in the scope script.
2015-07-16 12:33:59 +02:00
Tom Wilkie
c2065836e2 Make NodeMetadata a struct, move existing map[string]string to NodeMetadata.Metadata 2015-07-15 10:06:36 +00:00
Tom Wilkie
9fc02d941e Fix flaky tests
- Make poll take interfaces, do diff on error
- Use poll in TestRegistryEvents
- Improve the locking to prevent deadlocks and data races in registry_test.go
2015-07-08 13:54:09 +00:00
Tom Wilkie
d2d73c3cd4 Add -cpu 4 to tests. 2015-07-06 15:07:33 +00:00
Paul Bellamy
95f941ff2d const-izing NodeMetadata fields 2015-07-02 14:51:12 +01:00
Paul Bellamy
a9b53f6d76 refactoring some common logic 2015-07-02 14:19:38 +01:00
Peter Bourgon
d9a37df783 WeaveTagger becomes Weave, both Reporter & Tagger 2015-06-30 12:05:32 +02:00
Peter Bourgon
f4b3930a19 Probe re-org
- tag/weave* -> package overlay
- tag/origin_host* -> package host
- tag/topology* -> package main
2015-06-30 10:18:00 +02:00
Peter Bourgon
69785493ba Merge pull request #289 from weaveworks/fix-host-on-darwin
Fix host on darwin
2015-06-29 18:32:18 +02:00
Peter Bourgon
36212cea3e Fix probe/host for Darwin
Also, add explicit GOOS=darwin target for circle.
2015-06-29 18:27:22 +02:00
Peter Bourgon
f8be412dbb Remove forgotten half-comment line 2015-06-29 15:08:39 +02:00
Tom Wilkie
b9e968ff43 Cache the walk of the process tree, reusing it in docker tagger and process reporter.
Update the cache every spy tick.

This change make CPU usage of scope on my box go from ~40% to ~17%.
2015-06-29 11:16:38 +00:00
Tom Wilkie
eb250ecb7c Trim whitespace from process names
This causes detailed node lookups for the grouped-by-process-name view to fail.  Also, add a test for process walker trimmming whitespace, and a test the process-by-name view gives the right result.
2015-06-24 14:01:17 +00:00
Tom Wilkie
ead58a3483 Make scope compile on Mac again. 2015-06-23 15:41:12 +00:00
Tom Wilkie
626320d7f4 Move probe host topology code into its own module
- add tests
- use constants for NodeMetadata keys
- add host uptime and kernel version
2015-06-23 13:31:22 +00:00
Tom Wilkie
a4ddd0094f Duplicate endpoints in the endpoint topology to account for NAT mapping.
Also, move spy.go into probe/endpoint and make it adhere to the Reporter interface.
2015-06-23 10:33:06 +00:00
Tom Wilkie
560cf66454 Refactor PIDTree
- Move pidtree to its own module and disaggregate it into tree, walker and reporter.
- Extend testing for probe/process
- Extend process metadata; add command line & # threads.
2015-06-23 09:40:35 +00:00
Tom Wilkie
82a7f93e17 Treat addresses on the docker bridge as local. 2015-06-22 11:24:47 +00:00
Tom Wilkie
c793e86d5b Expose some more information on containers. 2015-06-19 13:02:07 +00:00
Tom Wilkie
49dae07cca Make render module produce The Internet pseudo node. 2015-06-19 11:09:52 +00:00
Tom Wilkie
314af5ca89 Improve probe docker code quality & test coverage.
- Move docker probe code into it's own module
- Put PIDTree behind and interface for mocking
- Disaggregate dockerTagger into a registry, tagger and reporter
- Similarly disaggregate tests
- Add mocks for docker container and registry
- Add test for docker events & stats
2015-06-18 17:09:33 +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
f30539601d Restore docker tagging to the endpoint topology until we have the docker images topology. 2015-06-17 17:29:37 +00:00
Tom Wilkie
ee9ac591fd DockerTagger should tag the Process topology now. 2015-06-17 17:23:31 +00:00
Tom Wilkie
786a1588ea Don't emit process name and domain from procspy. 2015-06-17 17:23:29 +00:00
Tom Wilkie
16e2ccd2be Produce the container topology by way of the process topology. 2015-06-17 17:23:20 +00:00
Peter Bourgon
e3c5b7f36d Add WeaveTagger
- report: add Overlay topology
- probe/tag: introduce WeaveTagger
2015-06-16 16:29:50 +02:00
Tom Wilkie
e84848278a Merge pull request #234 from tomwilkie/114-docker-stats
Add docker stats to the Container Topology
2015-06-16 10:53:03 +02:00
Peter Bourgon
20eb64968b probe: origin host tagger: use report.Topologies method 2015-06-15 14:58:27 +02:00
Peter Bourgon
c65aecd9e1 Fix node scoping rules
We only want to scope (i.e. prefix with hostID) those addresses that are
deemed loopback, to disambiguate them. Otherwise, we want to leave
addresses in unscoped form, so they can be matched, and links between
communicating nodes properly made.

So, we make the isLoopback check in MakeAddressID, and omit hostID if
the address isn't loopback. So far so good.

But this breaks topology rendering, as we were relying on extracting
hostID from adjacency node IDs, to populate origin hosts in the rendered
node output. So we need another way to get origin host from an arbitrary
node.

A survey revealed no reliable way to get that information from IDs in
their new form. However, we have access to node metadata, so this
changeset introduces the OriginHostTagger, which tags each node with its
origin host, via the foreign-key semantics we'll use going forward.
2015-06-15 14:36:48 +02:00
Peter Bourgon
8dc44012f0 probe: don't spam logs on Darwin 2015-06-12 12:56:59 +02:00
Tom Wilkie
a2adaa2566 Add docker stats to the Container Topology 2015-06-11 18:42:35 +00:00
Tom Wilkie
53456179e4 All merging of RenderableNodes, such that we can merge multiple topologies. 2015-06-11 17:11:10 +00:00
Tom Wilkie
ae84861e00 Now we have merged topologies, we don't need to put so much data on the endpoint topology, or render so much info. 2015-06-11 16:57:24 +00:00
Tom Wilkie
ff11022862 Add Containers topology populated by the Docker tagger. 2015-06-10 16:01:15 +00:00