Commit Graph
100 Commits
Author SHA1 Message Date
Peter BourgonandSimon Howe e0fab36351 Re-sync container on network dis/connect 2016-06-06 16:24:03 +02:00
Peter BourgonandSimon Howe 10ced2d09d First cut of network data 2016-06-06 16:24:02 +02:00
Peter BourgonandTom Wilkie c68516ec22 report: add StringSet (port of IDList, effectively) 2015-10-27 14:12:34 +00:00
Peter BourgonandTom Wilkie cb40ad3a90 Continued un-exporting of symbols; renames
- Unexport consts, types, vars, etc.
- Rename Conntracker (interface) to FlowWalker, to match its definition.
- Rename conntracker (type) to conntrackWalker, to match the interface.
- Move conntrack_test.go to conntrack_internal_test.go and package endpoint
2015-10-27 10:40:09 +00:00
Peter BourgonandTom Wilkie 6ae5077515 Un-export NATMapper
Lots of TODOs to clean up...
2015-10-27 10:38:22 +00:00
Peter BourgonandTom Wilkie 36ce1089f4 Don't export reverseResolver
It's only used within package endpoint, so it shouldn't be exported.
That means resolver_test becomes resolver_internal_test, and with the
previous change to the fixture, we can avoid the dot-import.

Also, update method names to reflect it's an unexported type.
2015-10-27 10:38:19 +00:00
Peter BourgonandTom Wilkie c8fbea0f15 Move fixture to its own package
We want to be able to import test from packages like probe/endpoint, in
order to use utility functions like poll. But that causes an import
cycle with the current layout. We got around this using dot-imports so
far, but it's ugly and unnecessary: fixture can be its own package.
2015-10-27 10:36:53 +00:00
Peter BourgonandTom Wilkie 65a7547415 Intermediate stage fix 2015-10-27 10:36:53 +00:00
Peter BourgonandTom Wilkie 32a57e63db probe/endpoint: NATMapper missed an edge case
NATMapper can be created with a nil Conntracker if
ConntrackerModulePresent is false, e.g. on Darwin.
Check for that in ApplyNAT.
2015-10-27 10:36:52 +00:00
Peter BourgonandTom Wilkie a48b6d4d1e Let's not squash. 2015-10-23 16:35:46 +00:00
Peter Bourgon 303bed1e2b Makefile: fix indentation 2015-10-23 14:38:17 +01:00
Peter Bourgon 5ac8ce5622 Move scope.md to main README. Updates, also. 2015-10-19 18:26:56 +02:00
Peter Bourgon 4347da3ec6 Fix for lint 2015-10-02 15:03:13 +02:00
Peter Bourgon 4a7a7a6dda Another fix from the old release script 2015-10-01 10:54:24 -04:00
Peter Bourgon 81aa92d13b Show why some nodes are filtered in applications view 2015-10-01 15:57:04 +02:00
Peter Bourgon e14e2a878e Make report swapping less fragile 2015-10-01 14:42:01 +02:00
Peter Bourgon 79356100d7 We don't 'make test', we do something else 2015-10-01 10:44:13 +02:00
Peter Bourgon e8ddecebd1 Fix -tags netgo 2015-10-01 10:17:06 +02:00
Peter Bourgon 6744a3677f Latest bin/release script from weave repo 2015-10-01 10:00:21 +02:00
Peter Bourgon a086bbe846 Re-introduce experimental/graphviz 2015-09-30 17:30:27 +02:00
Peter Bourgon 2a957044fb CHANGELOG: Remove mention of unit and integration test coverage 2015-09-30 11:16:02 +02:00
Peter Bourgon e1ea2b234b make static 2015-09-30 05:14:51 -04:00
Peter Bourgon cf05284fb9 0.8.0: update CHANGELOG 2015-09-30 10:07:52 +02:00
Peter Bourgon 5813211f0c vendor/runsvinit: update vendored copy 2015-09-29 14:29:28 +02:00
Peter Bourgon b78be6a71b xfer: fix TestBackgroundPublisher 2015-09-29 13:32:52 +02:00
Peter Bourgon 36b743fe1f probe, app: reliable shutdown
- Restructure main funcs for clean defer-stack-unwinds
- Fix Docker container to handle signals properly
- Introduce runsvinit for container init process
- Integration test
2015-09-29 11:45:12 +02:00
Peter Bourgon 8602132ab6 Move concurrency from resolve to HTTP GET
- Process DNS resolution serially
- Process up to 10 HTTP GET (for app ID) concurrently

More than 10 concurrent GET requests will block on the semaphore. This
will cause the staticResolver.resolve method to block, which is probably
fine: it will just delay the next resolve loop, currently at 1m
intervals.

To make this a little bit more robust, I've also added a fastClient for
app ID resolution, with a timeout (total, including connect, request,
and response) of 5s.
2015-09-24 16:56:37 +02:00
Peter Bourgon eccc74aafe Make the resolver concurrent 2015-09-24 16:11:55 +02:00
Peter Bourgon 790da39f04 Publish an io.Reader, not a bytes.Buffer 2015-09-24 16:11:55 +02:00
Peter Bourgon eca45ca9d5 Need to copy the buffer in the MultiPublisher 2015-09-24 16:11:55 +02:00
Peter Bourgon c818f08c06 Refactor MultiPublisher
- Set instead of Add, to allow replacement of endpoints
- Break out individual Publishers to their own files and tests
2015-09-24 16:11:55 +02:00
Peter Bourgon 64fdf6a780 common/sanitize + relevant updates 2015-09-24 16:11:54 +02:00
Peter Bourgon 822c09370e app: show unique ID in /api 2015-09-24 16:11:54 +02:00
Peter Bourgon c607ee00d8 probe/sniff: move to experimental
Resolves #466
2015-09-23 14:38:41 +02:00
Peter Bourgon eec00541de README: need make deps 2015-09-16 17:52:18 +02:00
Peter Bourgon 4a4aea5663 make static 2015-09-16 12:30:21 +02:00
Peter Bourgon 70b57c3e4b make static 2015-09-15 18:47:22 +02:00
Peter Bourgon 1001f550c0 Fix bad merge on Darwin 2015-09-14 15:55:38 +02:00
Peter Bourgon 65b78206ee xfer: move Buffer to own file; update comment
overlay: mutex for Weave status
2015-09-11 10:12:14 +02:00
Peter Bourgon b97407a540 Use local checkout 2015-09-10 16:58:49 +02:00
Peter Bourgon dde214c103 Put the binaries in the official place 2015-09-10 15:43:19 +02:00
Peter Bourgon fc95067bd3 First cut of Docker build for backend 2015-09-10 15:38:48 +02:00
Peter Bourgon 208abfa34a rm Sterilize, use Prune 2015-09-08 12:00:10 +02:00
Peter Bourgon b1f316ffc7 Add Prune method (née Sterilize) 2015-09-08 11:50:18 +02: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 e81efe6c14 make static 2015-09-07 11:10:48 -04:00
Peter BourgonandTom Wilkie 1dfc725706 Filter system containers from topologies; add API to control filters. 2015-09-07 14:24:15 +00:00
Peter Bourgon 7513b4e396 Wrap comments at 80col throughout the fileset 2015-09-07 10:36:35 +02:00
Peter Bourgon 66c597ecf9 Remove debug code that snuck in 2015-09-01 09:36:57 +02:00
Peter Bourgon cdaaf2e1da probe: unnecessary Copy in test 2015-08-27 17:30:50 +02:00
Peter Bourgon fcecb92206 Ugh. 2015-08-27 16:54:06 +02:00
Peter Bourgon 6d2252f604 app: fixes for new merge semantics 2015-08-26 12:02:11 +01:00
Peter Bourgon 775f0ede90 render: fixes for new merge semantics 2015-08-26 12:02:11 +01:00
Peter Bourgon 8f55c74b27 xfer: fixes for new merge semantics 2015-08-26 12:02:11 +01:00
Peter Bourgon d5ab8177f6 probe: fixes for new merge semantics 2015-08-26 12:02:03 +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
Peter Bourgon a1b0088bf3 Remove (comm) from Name field in detail pane 2015-08-19 11:07:31 +02:00
Peter Bourgon 43bfecbba4 Add X-Scope-Probe-ID header to POSTs 2015-08-13 13:01:58 +02:00
Peter Bourgon edf0ceb212 Authorization: Scope-Probe token=<token> 2015-08-07 18:52:16 +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 3fd5fbcf25 app may only log to stderr, just like probe 2015-08-06 19:30:58 +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 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
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 a565acc871 Unbreak the build 2015-07-22 14:26:09 +01:00
Peter Bourgon 6f414ac89c Process rank by comm (app name) 2015-07-22 10:51:58 +01: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
Peter Bourgon c8079daf26 Improve scope script <--> weave interaction
- Use command_exists function from weave script
- Collapse boolean checks for DNS registration
2015-07-15 12:10:50 +02:00
Peter Bourgon 53e70b02f4 Don't fast-fail if weave isn't present 2015-07-15 11:57:48 +02:00
Peter Bourgon ac29fba7bc Don't fail if CACHE_DIR has a missing component
Also, don't invoke weave if it's not running.
2015-07-13 16:03:19 +02:00
Peter Bourgon c57a04e1dd Use weave add-dns instead of HTTP calls to DNS container 2015-07-13 12:47:21 +02:00
Peter Bourgon edee9b2434 weave expose prior to scope launch 2015-07-02 18:25:10 +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 ea9eaae26a In Docker, {app,probe} -> {scope-app,scope-probe} 2015-06-29 18:59:19 +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 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
Peter Bourgon f8be412dbb Remove forgotten half-comment line 2015-06-29 15:08:39 +02:00
Peter Bourgon e3c5b7f36d Add WeaveTagger
- report: add Overlay topology
- probe/tag: introduce WeaveTagger
2015-06-16 16:29:50 +02:00
Peter Bourgon 49ec565a04 Improve error messages during report validation 2015-06-16 10:42:40 +02:00
Peter Bourgon 20eb64968b probe: origin host tagger: use report.Topologies method 2015-06-15 14:58:27 +02:00
Peter Bourgon c900c17ad5 app: fix tests 2015-06-15 14:51:19 +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 e726ee6fde make static 2015-06-15 12:54:27 +02:00
Peter Bourgon dcb23a517a bin/release: fix sed invocation 2015-06-15 12:49:47 +02:00
Peter Bourgon e44da9668b CHANGELOG.md: v0.3.0 2015-06-15 12:49:47 +02:00
Peter Bourgon 032e78d99d Dedupe tables in detail pane 2015-06-15 11:20:30 +02:00
Peter Bourgon 3e8bdcc854 Sub-topolgies rendered in one place only 2015-06-15 10:26:22 +02:00
Peter Bourgon 086ff3b791 Change from grouped URL to sub-topologies 2015-06-12 13:23:25 +02:00