{"action":"created","comment":{"url":"https://api.github.com/repos/weaveworks/scope/pulls/comments/97079423","pull_request_review_id":17684009,"id":97079423,"diff_hunk":"@@ -41,7 +58,11 @@ docker/weave:\n \tcurl -L git.io/weave -o docker/weave\n \tchmod u+x docker/weave\n \n-$(SCOPE_EXPORT): $(SCOPE_EXE) $(DOCKER_DISTRIB) docker/weave $(RUNSVINIT) docker/Dockerfile docker/demo.json docker/run-app docker/run-probe docker/entrypoint.sh\n+docker/ebpf.tgz: Makefile\n+\t$(SUDO) docker pull $(EBPF_IMAGE)\n+\tCONTAINER_ID=$(shell $(SUDO) docker run -d $(EBPF_IMAGE) /bin/false 2>/dev/null || true); $(SUDO) docker export -o docker/ebpf.tgz $${CONTAINER_ID}","path":"Makefile","position":43,"original_position":43,"commit_id":"020d9670e29b0fe3d75f2041820438a4513e18ca","original_commit_id":"020d9670e29b0fe3d75f2041820438a4513e18ca","user":{"login":"iaguis","id":507354,"avatar_url":"https://avatars.githubusercontent.com/u/507354?v=3","gravatar_id":"","url":"https://api.github.com/users/iaguis","html_url":"https://github.com/iaguis","followers_url":"https://api.github.com/users/iaguis/followers","following_url":"https://api.github.com/users/iaguis/following{/other_user}","gists_url":"https://api.github.com/users/iaguis/gists{/gist_id}","starred_url":"https://api.github.com/users/iaguis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iaguis/subscriptions","organizations_url":"https://api.github.com/users/iaguis/orgs","repos_url":"https://api.github.com/users/iaguis/repos","events_url":"https://api.github.com/users/iaguis/events{/privacy}","received_events_url":"https://api.github.com/users/iaguis/received_events","type":"User","site_admin":false},"body":"I can't fork it or create a PR because it's empty","created_at":"2017-01-20T14:21:46Z","updated_at":"2017-01-20T14:21:46Z","html_url":"https://github.com/weaveworks/scope/pull/2135#discussion_r97079423","pull_request_url":"https://api.github.com/repos/weaveworks/scope/pulls/2135","_links":{"self":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/comments/97079423"},"html":{"href":"https://github.com/weaveworks/scope/pull/2135#discussion_r97079423"},"pull_request":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/2135"}}},"pull_request":{"url":"https://api.github.com/repos/weaveworks/scope/pulls/2135","id":101866240,"html_url":"https://github.com/weaveworks/scope/pull/2135","diff_url":"https://github.com/weaveworks/scope/pull/2135.diff","patch_url":"https://github.com/weaveworks/scope/pull/2135.patch","issue_url":"https://api.github.com/repos/weaveworks/scope/issues/2135","number":2135,"state":"open","locked":false,"title":"Add eBPF connection tracking without dependencies on kernel headers","user":{"login":"iaguis","id":507354,"avatar_url":"https://avatars.githubusercontent.com/u/507354?v=3","gravatar_id":"","url":"https://api.github.com/users/iaguis","html_url":"https://github.com/iaguis","followers_url":"https://api.github.com/users/iaguis/followers","following_url":"https://api.github.com/users/iaguis/following{/other_user}","gists_url":"https://api.github.com/users/iaguis/gists{/gist_id}","starred_url":"https://api.github.com/users/iaguis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iaguis/subscriptions","organizations_url":"https://api.github.com/users/iaguis/orgs","repos_url":"https://api.github.com/users/iaguis/repos","events_url":"https://api.github.com/users/iaguis/events{/privacy}","received_events_url":"https://api.github.com/users/iaguis/received_events","type":"User","site_admin":false},"body":"Based on work from Lorenzo, updated by Iago, Alban, Alessandro and\r\nMichael.\r\n\r\nThis PR adds connection tracking using eBPF. This feature is not enabled by default.\r\nFor now, you can enable it by launching scope with the following command:\r\n\r\n```\r\nsudo ./scope launch --probe.ebpf.connections=true\r\n```\r\n\r\nThis patch allows scope to get notified of every connection event,\r\nwithout relying on the parsing of /proc/$pid/net/tcp{,6} and\r\n/proc/$pid/fd/*, and therefore improve performance.\r\n\r\nWe vendor https://github.com/iovisor/gobpf in Scope to load the\r\npre-compiled ebpf program and https://github.com/kinvolk/tcptracer-bpf\r\nto guess the offsets of the structures we need in the kernel. In this\r\nway we don't need a different pre-compiled ebpf object file per kernel.\r\nThe Scope build fetches the pre-compiled ebpf program from\r\nhttps://hub.docker.com/r/kinvolk/tcptracer-bpf/ (see\r\nhttps://github.com/kinvolk/tcptracer-bpf). To update to a new version\r\nyou can modify the EBPF_IMAGE variable in Makefile.\r\n\r\nThe ebpf program uses kprobes/kretprobes on the following kernel functions:\r\n- tcp_v4_connect\r\n- tcp_v6_connect\r\n- tcp_set_state\r\n- inet_csk_accept\r\n- tcp_close\r\n\r\nIt generates \"connect\", \"accept\" and \"close\" events containing the\r\nconnection tuple but also pid and netns.\r\nNote: the IPv6 events are not supported in Scope and thus not passed on.\r\n\r\nprobe/endpoint/ebpf.go maintains the list of connections. Similarly to\r\nconntrack, it also keeps the dead connections for one iteration in order\r\nto report short-lived connections.\r\n\r\nThe code for parsing /proc/$pid/net/tcp{,6} and /proc/$pid/fd/* is still\r\nthere and still used at start-up because eBPF only brings us the events\r\nand not the initial state. However, the /proc parsing for the initial\r\nstate is now done in foreground instead of background, via\r\nnewForegroundReader().\r\n\r\nNAT resolution on connections from eBPF works in the same way as it did\r\non connections from /proc: by using conntrack. One of the two conntrack\r\ninstances is only started to get the initial state and then it is\r\nstopped since eBPF detects short-lived connections.\r\n\r\nThe Scope Docker image size comparison:\r\n- weaveworks/scope in current master:  22 MB (compressed),  68 MB\r\n  (uncompressed)\r\n- weaveworks/scope with this patchset: 23 MB (compressed), 69 MB\r\n  (uncompressed)\r\n\r\nFixes #1168 (walking /proc to obtain connections is very expensive)\r\nFixes #1260 (Short-lived connections not tracked for containers in\r\nshared networking namespaces)\r\nFixes #1962 (Port ebpf tracker to Go)\r\nFixes #1961 (Remove runtime kernel header dependency from ebpf tracker)\r\n\r\nThis PR is kernel version/configuration independent so it supersedes https://github.com/weaveworks/scope/pull/2070 which needed a different object file per kernel/kernel config.\r\n\r\nDepends on https://github.com/weaveworks/scope/pull/2068\r\n\r\nTODO:\r\n\r\n* [ ] Gracefully fall back to proc parsing if the user enables ebpf with `--probe.ebpf.connections=true` and the ebpf loading fails for whatever reason. We can fix this in a followup PR\r\n","created_at":"2017-01-17T13:45:45Z","updated_at":"2017-01-20T14:21:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a51a55df9513387abcbcb2576f986dd585ac848","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/weaveworks/scope/pulls/2135/commits","review_comments_url":"https://api.github.com/repos/weaveworks/scope/pulls/2135/comments","review_comment_url":"https://api.github.com/repos/weaveworks/scope/pulls/comments{/number}","comments_url":"https://api.github.com/repos/weaveworks/scope/issues/2135/comments","statuses_url":"https://api.github.com/repos/weaveworks/scope/statuses/020d9670e29b0fe3d75f2041820438a4513e18ca","head":{"label":"kinvolk:iaguis/conn-perf-ebpf-guess","ref":"iaguis/conn-perf-ebpf-guess","sha":"020d9670e29b0fe3d75f2041820438a4513e18ca","user":{"login":"kinvolk","id":14073052,"avatar_url":"https://avatars.githubusercontent.com/u/14073052?v=3","gravatar_id":"","url":"https://api.github.com/users/kinvolk","html_url":"https://github.com/kinvolk","followers_url":"https://api.github.com/users/kinvolk/followers","following_url":"https://api.github.com/users/kinvolk/following{/other_user}","gists_url":"https://api.github.com/users/kinvolk/gists{/gist_id}","starred_url":"https://api.github.com/users/kinvolk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinvolk/subscriptions","organizations_url":"https://api.github.com/users/kinvolk/orgs","repos_url":"https://api.github.com/users/kinvolk/repos","events_url":"https://api.github.com/users/kinvolk/events{/privacy}","received_events_url":"https://api.github.com/users/kinvolk/received_events","type":"Organization","site_admin":false},"repo":{"id":52687285,"name":"scope","full_name":"kinvolk/scope","owner":{"login":"kinvolk","id":14073052,"avatar_url":"https://avatars.githubusercontent.com/u/14073052?v=3","gravatar_id":"","url":"https://api.github.com/users/kinvolk","html_url":"https://github.com/kinvolk","followers_url":"https://api.github.com/users/kinvolk/followers","following_url":"https://api.github.com/users/kinvolk/following{/other_user}","gists_url":"https://api.github.com/users/kinvolk/gists{/gist_id}","starred_url":"https://api.github.com/users/kinvolk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinvolk/subscriptions","organizations_url":"https://api.github.com/users/kinvolk/orgs","repos_url":"https://api.github.com/users/kinvolk/repos","events_url":"https://api.github.com/users/kinvolk/events{/privacy}","received_events_url":"https://api.github.com/users/kinvolk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kinvolk/scope","description":"Monitoring, visualisation & management for Docker","fork":true,"url":"https://api.github.com/repos/kinvolk/scope","forks_url":"https://api.github.com/repos/kinvolk/scope/forks","keys_url":"https://api.github.com/repos/kinvolk/scope/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kinvolk/scope/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kinvolk/scope/teams","hooks_url":"https://api.github.com/repos/kinvolk/scope/hooks","issue_events_url":"https://api.github.com/repos/kinvolk/scope/issues/events{/number}","events_url":"https://api.github.com/repos/kinvolk/scope/events","assignees_url":"https://api.github.com/repos/kinvolk/scope/assignees{/user}","branches_url":"https://api.github.com/repos/kinvolk/scope/branches{/branch}","tags_url":"https://api.github.com/repos/kinvolk/scope/tags","blobs_url":"https://api.github.com/repos/kinvolk/scope/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kinvolk/scope/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kinvolk/scope/git/refs{/sha}","trees_url":"https://api.github.com/repos/kinvolk/scope/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kinvolk/scope/statuses/{sha}","languages_url":"https://api.github.com/repos/kinvolk/scope/languages","stargazers_url":"https://api.github.com/repos/kinvolk/scope/stargazers","contributors_url":"https://api.github.com/repos/kinvolk/scope/contributors","subscribers_url":"https://api.github.com/repos/kinvolk/scope/subscribers","subscription_url":"https://api.github.com/repos/kinvolk/scope/subscription","commits_url":"https://api.github.com/repos/kinvolk/scope/commits{/sha}","git_commits_url":"https://api.github.com/repos/kinvolk/scope/git/commits{/sha}","comments_url":"https://api.github.com/repos/kinvolk/scope/comments{/number}","issue_comment_url":"https://api.github.com/repos/kinvolk/scope/issues/comments{/number}","contents_url":"https://api.github.com/repos/kinvolk/scope/contents/{+path}","compare_url":"https://api.github.com/repos/kinvolk/scope/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kinvolk/scope/merges","archive_url":"https://api.github.com/repos/kinvolk/scope/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kinvolk/scope/downloads","issues_url":"https://api.github.com/repos/kinvolk/scope/issues{/number}","pulls_url":"https://api.github.com/repos/kinvolk/scope/pulls{/number}","milestones_url":"https://api.github.com/repos/kinvolk/scope/milestones{/number}","notifications_url":"https://api.github.com/repos/kinvolk/scope/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kinvolk/scope/labels{/name}","releases_url":"https://api.github.com/repos/kinvolk/scope/releases{/id}","deployments_url":"https://api.github.com/repos/kinvolk/scope/deployments","created_at":"2016-02-27T20:29:49Z","updated_at":"2017-01-06T20:38:28Z","pushed_at":"2017-01-19T14:42:14Z","git_url":"git://github.com/kinvolk/scope.git","ssh_url":"git@github.com:kinvolk/scope.git","clone_url":"https://github.com/kinvolk/scope.git","svn_url":"https://github.com/kinvolk/scope","homepage":"http://weave.works/product/scope/","size":49754,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"weaveworks:master","ref":"master","sha":"589171b46916e3f9b4084f5197363a3706285110","user":{"login":"weaveworks","id":9976052,"avatar_url":"https://avatars.githubusercontent.com/u/9976052?v=3","gravatar_id":"","url":"https://api.github.com/users/weaveworks","html_url":"https://github.com/weaveworks","followers_url":"https://api.github.com/users/weaveworks/followers","following_url":"https://api.github.com/users/weaveworks/following{/other_user}","gists_url":"https://api.github.com/users/weaveworks/gists{/gist_id}","starred_url":"https://api.github.com/users/weaveworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaveworks/subscriptions","organizations_url":"https://api.github.com/users/weaveworks/orgs","repos_url":"https://api.github.com/users/weaveworks/repos","events_url":"https://api.github.com/users/weaveworks/events{/privacy}","received_events_url":"https://api.github.com/users/weaveworks/received_events","type":"Organization","site_admin":false},"repo":{"id":34659664,"name":"scope","full_name":"weaveworks/scope","owner":{"login":"weaveworks","id":9976052,"avatar_url":"https://avatars.githubusercontent.com/u/9976052?v=3","gravatar_id":"","url":"https://api.github.com/users/weaveworks","html_url":"https://github.com/weaveworks","followers_url":"https://api.github.com/users/weaveworks/followers","following_url":"https://api.github.com/users/weaveworks/following{/other_user}","gists_url":"https://api.github.com/users/weaveworks/gists{/gist_id}","starred_url":"https://api.github.com/users/weaveworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaveworks/subscriptions","organizations_url":"https://api.github.com/users/weaveworks/orgs","repos_url":"https://api.github.com/users/weaveworks/repos","events_url":"https://api.github.com/users/weaveworks/events{/privacy}","received_events_url":"https://api.github.com/users/weaveworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/weaveworks/scope","description":"Monitoring, visualisation & management for Docker & Kubernetes","fork":false,"url":"https://api.github.com/repos/weaveworks/scope","forks_url":"https://api.github.com/repos/weaveworks/scope/forks","keys_url":"https://api.github.com/repos/weaveworks/scope/keys{/key_id}","collaborators_url":"https://api.github.com/repos/weaveworks/scope/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/weaveworks/scope/teams","hooks_url":"https://api.github.com/repos/weaveworks/scope/hooks","issue_events_url":"https://api.github.com/repos/weaveworks/scope/issues/events{/number}","events_url":"https://api.github.com/repos/weaveworks/scope/events","assignees_url":"https://api.github.com/repos/weaveworks/scope/assignees{/user}","branches_url":"https://api.github.com/repos/weaveworks/scope/branches{/branch}","tags_url":"https://api.github.com/repos/weaveworks/scope/tags","blobs_url":"https://api.github.com/repos/weaveworks/scope/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/weaveworks/scope/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/weaveworks/scope/git/refs{/sha}","trees_url":"https://api.github.com/repos/weaveworks/scope/git/trees{/sha}","statuses_url":"https://api.github.com/repos/weaveworks/scope/statuses/{sha}","languages_url":"https://api.github.com/repos/weaveworks/scope/languages","stargazers_url":"https://api.github.com/repos/weaveworks/scope/stargazers","contributors_url":"https://api.github.com/repos/weaveworks/scope/contributors","subscribers_url":"https://api.github.com/repos/weaveworks/scope/subscribers","subscription_url":"https://api.github.com/repos/weaveworks/scope/subscription","commits_url":"https://api.github.com/repos/weaveworks/scope/commits{/sha}","git_commits_url":"https://api.github.com/repos/weaveworks/scope/git/commits{/sha}","comments_url":"https://api.github.com/repos/weaveworks/scope/comments{/number}","issue_comment_url":"https://api.github.com/repos/weaveworks/scope/issues/comments{/number}","contents_url":"https://api.github.com/repos/weaveworks/scope/contents/{+path}","compare_url":"https://api.github.com/repos/weaveworks/scope/compare/{base}...{head}","merges_url":"https://api.github.com/repos/weaveworks/scope/merges","archive_url":"https://api.github.com/repos/weaveworks/scope/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/weaveworks/scope/downloads","issues_url":"https://api.github.com/repos/weaveworks/scope/issues{/number}","pulls_url":"https://api.github.com/repos/weaveworks/scope/pulls{/number}","milestones_url":"https://api.github.com/repos/weaveworks/scope/milestones{/number}","notifications_url":"https://api.github.com/repos/weaveworks/scope/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/weaveworks/scope/labels{/name}","releases_url":"https://api.github.com/repos/weaveworks/scope/releases{/id}","deployments_url":"https://api.github.com/repos/weaveworks/scope/deployments","created_at":"2015-04-27T10:12:35Z","updated_at":"2017-01-19T11:15:17Z","pushed_at":"2017-01-20T13:44:20Z","git_url":"git://github.com/weaveworks/scope.git","ssh_url":"git@github.com:weaveworks/scope.git","clone_url":"https://github.com/weaveworks/scope.git","svn_url":"https://github.com/weaveworks/scope","homepage":"https://www.weave.works/product/weave-scope/","size":46884,"stargazers_count":964,"watchers_count":964,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":97,"mirror_url":null,"open_issues_count":277,"forks":97,"open_issues":277,"watchers":964,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/2135"},"html":{"href":"https://github.com/weaveworks/scope/pull/2135"},"issue":{"href":"https://api.github.com/repos/weaveworks/scope/issues/2135"},"comments":{"href":"https://api.github.com/repos/weaveworks/scope/issues/2135/comments"},"review_comments":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/2135/comments"},"review_comment":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/2135/commits"},"statuses":{"href":"https://api.github.com/repos/weaveworks/scope/statuses/020d9670e29b0fe3d75f2041820438a4513e18ca"}}}}
{"actor":{"display_login":"iaguis"}}