Commit Graph

3554 Commits

Author SHA1 Message Date
Alfonso Acosta
3431d64f77 Adapt middleware logger to upstream changes 2017-03-21 15:20:17 +00:00
Alfonso Acosta
482a41f88e Bump github.com/weaveworks/common 2017-03-21 11:49:02 +00:00
Alfonso Acosta
ae58cd7710 Fix stderr obtention
* The Stderr pipe should be read before waiting
* The Stderr pipe should not be used with Run/Output. See https://golang.org/pkg/os/exec/#Cmd.StderrPipe:

  Wait will close the pipe after seeing the command exit, so most callers need
  not close the pipe themselves; however, an implication is that it is incorrect
  to call Wait before all reads from the pipe have completed. For the same
  reason, it is incorrect to use Run when using StderrPipe.
2017-03-17 13:20:06 +00:00
Alfonso Acosta
31def70fc9 Improve error reporting when invoking weave script 2017-03-15 10:45:43 +00:00
Bryan Boreham
2fe3216e0a Merge pull request #2331 from weaveworks/decode-byte-slice
Decode via byte slice for memcache and file read
2017-03-14 15:41:45 +00:00
Bryan Boreham
b085c80ef3 Decode via byte slice for memcache and file read
This is more efficient, since the decoder can read field names in-place.
It also appears to be absolutely faster.
2017-03-14 14:54:17 +00:00
Bryan Boreham
07c8265c6b Update ugorji/co/codec to latest commit 708a42d246822952f38190a8d8c4e6b16a0e600c 2017-03-14 14:54:17 +00:00
Alfonso Acosta
a12ccf65d6 Merge pull request #2327 from kinvolk/schu/ebpf-proc-fallback
eBPF proc fallback
2017-03-14 07:40:31 -07:00
Michael Schubert
21047dc77f Add 313_container_to_container_edge_with_ebpf_proc_fallback_test.sh 2017-03-14 13:59:09 +01:00
Michael Schubert
22ae6c45a0 Implement ebpf proc fallback 2017-03-14 13:59:09 +01:00
Michael Schubert
5f2ba891a4 endpoint/reporter: only stop scanner if not nil 2017-03-14 11:56:04 +01:00
Michael Schubert
ce904fc56c Remove redundant arg from newEbpfTracker 2017-03-14 11:56:04 +01:00
Alfonso Acosta
250718d693 Merge pull request #2326 from kinvolk/schu/scope-dry-run
scope: use same Docker args for early dry run
2017-03-14 03:53:11 -07:00
Michael Schubert
5f85256055 scope: use same Docker args for early dry run
`launch` first does a `scope --dry-run` to parse and validate Scope
cmdline arguments before starting the main Scope container and
processes. Use the same Docker args for the dry run to make sure the
container has the same privileges and mount points. Otherwise valid
`$WEAVESCOPE_DOCKER_ARGS` might fail here.
2017-03-14 09:51:11 +01:00
jpellizzari
f975c12cf9 Change to re-fetch topologies on instance switch 2017-03-13 15:48:51 -07:00
Jordan Pellizzari
8dea285b6c Merge pull request #2317 from weaveworks/875-edge-arrows
Add edge arrows
2017-03-13 10:52:44 -07:00
jpellizzari
9b648834ee removed old marker code 2017-03-13 09:03:50 -07:00
jpellizzari
376e6f014e Added edge arrows 2017-03-10 12:10:51 -08:00
Matthias Radestock
456ac0bfb3 Merge pull request #2316 from weaveworks/2315-empty-proc-cmdline
fall back to /proc/<pid>/comm for process name

Fixes #2315
2017-03-09 15:35:34 +00:00
Matthias Radestock
245c2e9149 fall back to /proc/<pid>/comm for process name
when proc/<pid>/cmdline is empty, which is the case for some system
and defunct processes.

Fixes #2315
2017-03-09 14:02:32 +00:00
Alfonso Acosta
1d18ba6f13 Merge pull request #2314 from kinvolk/alban/disable-internet-edge-test
integration: disable tests with internet edge
2017-03-09 05:45:11 -08:00
Alban Crequy
b70f047407 integration: disable tests with internet edge
They are currently flaky.

See https://github.com/weaveworks/scope/issues/2308
2017-03-09 13:21:58 +01:00
Alfonso Acosta
6a22e7fd58 Merge pull request #2135 from kinvolk/iaguis/conn-perf-ebpf-guess
Add eBPF connection tracking without dependencies on kernel headers
2017-03-09 00:56:42 -08:00
Iago López Galeiras
6d55a344a6 integration: add tests for eBPF 2017-03-08 22:11:12 +01:00
Iago López Galeiras
0e05198162 integration: remove check if on us-central-1
There's no obvious reason why those tests can only be run on
us-central-1, remove the check.

It was added with 1577b90c6
2017-03-08 22:11:12 +01:00
Iago López Galeiras
9920c4ea48 Add eBPF connection tracking without dependencies on kernel headers
Based on work from Lorenzo, updated by Iago, Alban, Alessandro and
Michael.

This PR adds connection tracking using eBPF. This feature is not enabled by default.
For now, you can enable it by launching scope with the following command:

```
sudo ./scope launch --probe.ebpf.connections=true
```

This patch allows scope to get notified of every connection event,
without relying on the parsing of /proc/$pid/net/tcp{,6} and
/proc/$pid/fd/*, and therefore improve performance.

We vendor https://github.com/iovisor/gobpf in Scope to load the
pre-compiled ebpf program and https://github.com/weaveworks/tcptracer-bpf
to guess the offsets of the structures we need in the kernel. In this
way we don't need a different pre-compiled ebpf object file per kernel.
The pre-compiled ebpf program is included in the vendoring of
tcptracer-bpf.

The ebpf program uses kprobes/kretprobes on the following kernel functions:
- tcp_v4_connect
- tcp_v6_connect
- tcp_set_state
- inet_csk_accept
- tcp_close

It generates "connect", "accept" and "close" events containing the
connection tuple but also pid and netns.
Note: the IPv6 events are not supported in Scope and thus not passed on.

probe/endpoint/ebpf.go maintains the list of connections. Similarly to
conntrack, it also keeps the dead connections for one iteration in order
to report short-lived connections.

The code for parsing /proc/$pid/net/tcp{,6} and /proc/$pid/fd/* is still
there and still used at start-up because eBPF only brings us the events
and not the initial state. However, the /proc parsing for the initial
state is now done in foreground instead of background, via
newForegroundReader().

NAT resolution on connections from eBPF works in the same way as it did
on connections from /proc: by using conntrack. One of the two conntrack
instances is only started to get the initial state and then it is
stopped since eBPF detects short-lived connections.

The Scope Docker image size comparison:
- weaveworks/scope in current master:  22 MB (compressed),  68 MB
  (uncompressed)
- weaveworks/scope with this patchset: 23 MB (compressed), 69 MB
  (uncompressed)

Fixes #1168 (walking /proc to obtain connections is very expensive)

Fixes #1260 (Short-lived connections not tracked for containers in
shared networking namespaces)

Fixes #1962 (Port ebpf tracker to Go)

Fixes #1961 (Remove runtime kernel header dependency from ebpf tracker)
2017-03-08 22:11:12 +01:00
Iago López Galeiras
6ede5e5c91 vendor: add weaveworks/tcptracer-bpf 2017-03-08 22:11:12 +01:00
Iago López Galeiras
d77a297ebf vendor: add iovisor/gobpf 2017-03-08 22:11:12 +01:00
Jordan Pellizzari
743ead7678 Merge pull request #2290 from weaveworks/cancel-polling
Add logic to turn off network requests when Scope dismounts
2017-03-08 11:36:19 -08:00
jpellizzari
38d2b8ddff Added more granular JS API exports 2017-03-08 10:54:56 -08:00
Filip Barl
d3779a6111 Merge pull request #2291 from weaveworks/fix-search-throb-animation
Remove the throb animation for graph view search matches
2017-03-08 19:40:54 +01:00
Alfonso Acosta
052ff39bf1 Merge pull request #2309 from weaveworks/2258-fix-kubelet-access
Fix kubelet failure fallback and make port configurable
2017-03-08 10:15:21 -08:00
Alfonso Acosta
380d6cf8ba Merge pull request #2312 from weaveworks/secure-integration-tests
Secure integration tests
2017-03-08 08:27:04 -08:00
Alfonso Acosta
a7d37ed366 Merge commit 'b92447c6abbc8f8e6f1d33a8a4c961ba340dbf23' into secure-integration-tests 2017-03-08 16:23:06 +00:00
Alfonso Acosta
b92447c6ab Squashed 'tools/' changes from 52d695c..9e32194
9e32194 Secure GCP servers for Scope: open port 80.
a22536a Secure GCP servers for Scope.
89c3a29 Merge pull request #78 from weaveworks/lint-merge-rebase-issue-in-docs
73ad56d Add linter function to avoid bad merge/rebase artefact

git-subtree-dir: tools
git-subtree-split: 9e32194cf16f8f6eee7acb5dbf311c9003f0fedb
2017-03-08 16:23:04 +00:00
Alfonso Acosta
4c4b21ec66 Revert "Don't run integration tests, as the VMs are being compromised."
This reverts commit 093c21c207.
2017-03-08 14:43:33 +00:00
Tom Wilkie
093c21c207 Don't run integration tests, as the VMs are being compromised. 2017-03-08 14:30:15 +00:00
Alfonso Acosta
8bf753a51b Revert "Revert "Add options to hide args and env vars (#2306)"" (#2311)
* Revert "Revert "Add options to hide args and env vars (#2306)""

* Make linter happy
2017-03-08 02:16:42 -08:00
Matthias Radestock
1e53d590c7 Merge pull request #2310 from weaveworks/revert-2306-wip-2222
Revert "Add options to hide args and env vars (#2306)"
2017-03-08 06:01:17 +00:00
Matthias Radestock
69c80828d0 Merge pull request #2305 from weaveworks/quantise-reports
quantise reports
2017-03-08 05:27:48 +00:00
Alfonso Acosta
dcc7389127 Revert "Add options to hide args and env vars (#2306)"
This reverts commit 764afb6301.
2017-03-07 17:51:27 +01:00
Mike Bryant
764afb6301 Add options to hide args and env vars (#2306)
* Add options to hide args and env vars

To allow for use of weave-scope in an unauthenticated environment,
add options to the probe to hide comand line arguments and
environment variables, which might contain secret data.

Fixes #2222

* Change docker.NewRegistry arguments to be a struct

* Remove redundant declarations of default values

* Move registry options outside to improve readability
2017-03-07 08:51:18 -08:00
Alfonso Acosta
fb64f1102f Fix tests 2017-03-07 13:53:17 +00:00
Alfonso Acosta
c1fa5bb665 Fix kubelet failure fallback and make port configurable 2017-03-07 13:29:02 +00:00
Filip Barl
f87909282f Removed the throb animation for search matching. 2017-03-06 12:53:45 +01:00
Matthias Radestock
56892addfc quantise reports
Merge all reports received within a specified interval, discarding the
originals. This improves performance of Report() on repeated
invocation since it ends up merging fewer reports.

For example, if reports are received every second (e.g. 3 probes
reporting at the default probe.publishInterval of 3s), and the
app.windows is 15s (the default) and the report generation interval is
5s (e.g. one UI accessing every TOPOLOGY_INTERVAL; the default), then
the original code would have to merge 15 reports per UI access,
whereas this code will only need to merge 8 to 9 reports (3-4 merged
reports from previous invocation plus 5 recently received reports).
2017-03-06 10:33:03 +00:00
Matthias Radestock
a391ae8a3d Merge pull request #2301 from weaveworks/report-playback
report playback
2017-03-05 13:03:53 +00:00
Matthias Radestock
6bba59c3a0 Merge pull request #2300 from weaveworks/2299-probe-only
parse --probe-only as intended

Fixes #2299.
2017-03-05 12:06:05 +00:00
Matthias Radestock
289b4c63af report playback
Now you can launch the scope app with something like

./prog/scope --mode=app --weave=false --app.collector=file:///tmp/reports

and if the specified dir contains reports with filenames in the form
<timestamp>.{msgpack|json}[.gz],
e.g. "1488557088545489008.msgpack.gz", then these reports are replayed
in a loop at a sequence and speed determined by the timestamps.
2017-03-04 22:04:50 +00:00
Matthias Radestock
0aec6feed0 consistency: --no-app is used elsewhere; --probe-only isn't 2017-03-04 11:32:14 +00:00