{"action":"created","comment":{"url":"https://api.github.com/repos/uber/tchannel/pulls/comments/26865422","id":26865422,"diff_hunk":"@@ -105,12 +124,26 @@ TChannelOutgoingRequest.prototype.hookupCallback = function hookupCallback(callb\n     self.once('error', onError);\n     self.once('response', onResponse);\n     function onError(err) {\n+        // TODO: better annotations\n+        self.span.annotate('cr'); // client recv\n+        self.tracer.report(self.span);\n         self.removeListener('response', onResponse);\n+\n+        var prev = self.tracer.getCurrentSpan();\n+        self.tracer.setCurrentSpan(self.span);\n         callback(err, null);\n+        self.tracer.setCurrentSpan(prev);\n     }\n     function onResponse(res) {\n+        // TODO: better annotations\n+        self.span.annotate('cr');\n+        self.tracer.report(self.span);\n         self.removeListener('error', onError);\n+\n+        var prev = self.tracer.getCurrentSpan();\n+        self.tracer.setCurrentSpan(self.span);\n         callback(null, res);\n+        self.tracer.setCurrentSpan(prev);","path":"node/reqres.js","position":81,"original_position":81,"commit_id":"366a9b475682a7e09342eb502c5272bf2395781a","original_commit_id":"366a9b475682a7e09342eb502c5272bf2395781a","user":{"login":"rf","id":1093601,"avatar_url":"https://avatars.githubusercontent.com/u/1093601?v=3","gravatar_id":"","url":"https://api.github.com/users/rf","html_url":"https://github.com/rf","followers_url":"https://api.github.com/users/rf/followers","following_url":"https://api.github.com/users/rf/following{/other_user}","gists_url":"https://api.github.com/users/rf/gists{/gist_id}","starred_url":"https://api.github.com/users/rf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rf/subscriptions","organizations_url":"https://api.github.com/users/rf/orgs","repos_url":"https://api.github.com/users/rf/repos","events_url":"https://api.github.com/users/rf/events{/privacy}","received_events_url":"https://api.github.com/users/rf/received_events","type":"User","site_admin":false},"body":"`async-listener` takes care of setting and restoring the context during any async operations. Note that the tests use `setTimeout` and `process.nextTick` to test this.","created_at":"2015-03-20T18:43:05Z","updated_at":"2015-03-20T18:43:05Z","html_url":"https://github.com/uber/tchannel/pull/190#discussion_r26865422","pull_request_url":"https://api.github.com/repos/uber/tchannel/pulls/190","_links":{"self":{"href":"https://api.github.com/repos/uber/tchannel/pulls/comments/26865422"},"html":{"href":"https://github.com/uber/tchannel/pull/190#discussion_r26865422"},"pull_request":{"href":"https://api.github.com/repos/uber/tchannel/pulls/190"}}},"pull_request":{"url":"https://api.github.com/repos/uber/tchannel/pulls/190","id":31493475,"html_url":"https://github.com/uber/tchannel/pull/190","diff_url":"https://github.com/uber/tchannel/pull/190.diff","patch_url":"https://github.com/uber/tchannel/pull/190.patch","issue_url":"https://api.github.com/repos/uber/tchannel/issues/190","number":190,"state":"open","locked":false,"title":"Jank Tracing agent","user":{"login":"rf","id":1093601,"avatar_url":"https://avatars.githubusercontent.com/u/1093601?v=3","gravatar_id":"","url":"https://api.github.com/users/rf","html_url":"https://github.com/rf","followers_url":"https://api.github.com/users/rf/followers","following_url":"https://api.github.com/users/rf/following{/other_user}","gists_url":"https://api.github.com/users/rf/gists{/gist_id}","starred_url":"https://api.github.com/users/rf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rf/subscriptions","organizations_url":"https://api.github.com/users/rf/orgs","repos_url":"https://api.github.com/users/rf/repos","events_url":"https://api.github.com/users/rf/events{/privacy}","received_events_url":"https://api.github.com/users/rf/received_events","type":"User","site_admin":false},"body":"It's janky but it works. The points where we create spans and stuff should be in better places, in constructors, etc. Also had to pass around a ref to the tracer which is ugly. Works for my basic test cases, more test cases needed. \r\n\r\nPRed on the bufrw-tracing branch since it needs that\r\n\r\n@Raynos @kriskowal @jcorbin ","created_at":"2015-03-19T03:49:03Z","updated_at":"2015-03-20T18:43:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c6a4db8478f1871916b7c565d5fb9be781566f6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/uber/tchannel/pulls/190/commits","review_comments_url":"https://api.github.com/repos/uber/tchannel/pulls/190/comments","review_comment_url":"https://api.github.com/repos/uber/tchannel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uber/tchannel/issues/190/comments","statuses_url":"https://api.github.com/repos/uber/tchannel/statuses/366a9b475682a7e09342eb502c5272bf2395781a","head":{"label":"uber:tracing-agent","ref":"tracing-agent","sha":"366a9b475682a7e09342eb502c5272bf2395781a","user":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"repo":{"id":28419663,"name":"tchannel","full_name":"uber/tchannel","owner":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber/tchannel","description":"network multiplexing and framing protocol for RPC","fork":false,"url":"https://api.github.com/repos/uber/tchannel","forks_url":"https://api.github.com/repos/uber/tchannel/forks","keys_url":"https://api.github.com/repos/uber/tchannel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber/tchannel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber/tchannel/teams","hooks_url":"https://api.github.com/repos/uber/tchannel/hooks","issue_events_url":"https://api.github.com/repos/uber/tchannel/issues/events{/number}","events_url":"https://api.github.com/repos/uber/tchannel/events","assignees_url":"https://api.github.com/repos/uber/tchannel/assignees{/user}","branches_url":"https://api.github.com/repos/uber/tchannel/branches{/branch}","tags_url":"https://api.github.com/repos/uber/tchannel/tags","blobs_url":"https://api.github.com/repos/uber/tchannel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber/tchannel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber/tchannel/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber/tchannel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber/tchannel/statuses/{sha}","languages_url":"https://api.github.com/repos/uber/tchannel/languages","stargazers_url":"https://api.github.com/repos/uber/tchannel/stargazers","contributors_url":"https://api.github.com/repos/uber/tchannel/contributors","subscribers_url":"https://api.github.com/repos/uber/tchannel/subscribers","subscription_url":"https://api.github.com/repos/uber/tchannel/subscription","commits_url":"https://api.github.com/repos/uber/tchannel/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber/tchannel/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber/tchannel/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber/tchannel/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber/tchannel/contents/{+path}","compare_url":"https://api.github.com/repos/uber/tchannel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber/tchannel/merges","archive_url":"https://api.github.com/repos/uber/tchannel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber/tchannel/downloads","issues_url":"https://api.github.com/repos/uber/tchannel/issues{/number}","pulls_url":"https://api.github.com/repos/uber/tchannel/pulls{/number}","milestones_url":"https://api.github.com/repos/uber/tchannel/milestones{/number}","notifications_url":"https://api.github.com/repos/uber/tchannel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber/tchannel/labels{/name}","releases_url":"https://api.github.com/repos/uber/tchannel/releases{/id}","created_at":"2014-12-23T21:06:57Z","updated_at":"2015-03-20T18:39:33Z","pushed_at":"2015-03-20T18:39:33Z","git_url":"git://github.com/uber/tchannel.git","ssh_url":"git@github.com:uber/tchannel.git","clone_url":"https://github.com/uber/tchannel.git","svn_url":"https://github.com/uber/tchannel","homepage":"","size":5629,"stargazers_count":32,"watchers_count":32,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":36,"forks":3,"open_issues":36,"watchers":32,"default_branch":"master"}},"base":{"label":"uber:bufrw-tracing","ref":"bufrw-tracing","sha":"302f66a082c82653c4eb09118f5797cf390646b8","user":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"repo":{"id":28419663,"name":"tchannel","full_name":"uber/tchannel","owner":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber/tchannel","description":"network multiplexing and framing protocol for RPC","fork":false,"url":"https://api.github.com/repos/uber/tchannel","forks_url":"https://api.github.com/repos/uber/tchannel/forks","keys_url":"https://api.github.com/repos/uber/tchannel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber/tchannel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber/tchannel/teams","hooks_url":"https://api.github.com/repos/uber/tchannel/hooks","issue_events_url":"https://api.github.com/repos/uber/tchannel/issues/events{/number}","events_url":"https://api.github.com/repos/uber/tchannel/events","assignees_url":"https://api.github.com/repos/uber/tchannel/assignees{/user}","branches_url":"https://api.github.com/repos/uber/tchannel/branches{/branch}","tags_url":"https://api.github.com/repos/uber/tchannel/tags","blobs_url":"https://api.github.com/repos/uber/tchannel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber/tchannel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber/tchannel/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber/tchannel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber/tchannel/statuses/{sha}","languages_url":"https://api.github.com/repos/uber/tchannel/languages","stargazers_url":"https://api.github.com/repos/uber/tchannel/stargazers","contributors_url":"https://api.github.com/repos/uber/tchannel/contributors","subscribers_url":"https://api.github.com/repos/uber/tchannel/subscribers","subscription_url":"https://api.github.com/repos/uber/tchannel/subscription","commits_url":"https://api.github.com/repos/uber/tchannel/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber/tchannel/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber/tchannel/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber/tchannel/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber/tchannel/contents/{+path}","compare_url":"https://api.github.com/repos/uber/tchannel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber/tchannel/merges","archive_url":"https://api.github.com/repos/uber/tchannel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber/tchannel/downloads","issues_url":"https://api.github.com/repos/uber/tchannel/issues{/number}","pulls_url":"https://api.github.com/repos/uber/tchannel/pulls{/number}","milestones_url":"https://api.github.com/repos/uber/tchannel/milestones{/number}","notifications_url":"https://api.github.com/repos/uber/tchannel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber/tchannel/labels{/name}","releases_url":"https://api.github.com/repos/uber/tchannel/releases{/id}","created_at":"2014-12-23T21:06:57Z","updated_at":"2015-03-20T18:39:33Z","pushed_at":"2015-03-20T18:39:33Z","git_url":"git://github.com/uber/tchannel.git","ssh_url":"git@github.com:uber/tchannel.git","clone_url":"https://github.com/uber/tchannel.git","svn_url":"https://github.com/uber/tchannel","homepage":"","size":5629,"stargazers_count":32,"watchers_count":32,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":36,"forks":3,"open_issues":36,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uber/tchannel/pulls/190"},"html":{"href":"https://github.com/uber/tchannel/pull/190"},"issue":{"href":"https://api.github.com/repos/uber/tchannel/issues/190"},"comments":{"href":"https://api.github.com/repos/uber/tchannel/issues/190/comments"},"review_comments":{"href":"https://api.github.com/repos/uber/tchannel/pulls/190/comments"},"review_comment":{"href":"https://api.github.com/repos/uber/tchannel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uber/tchannel/pulls/190/commits"},"statuses":{"href":"https://api.github.com/repos/uber/tchannel/statuses/366a9b475682a7e09342eb502c5272bf2395781a"}}}}