{"action":"created","comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/35130449","id":35130449,"diff_hunk":"@@ -336,6 +341,82 @@ func (s *statusServer) handleLocalLog(w http.ResponseWriter, r *http.Request, ps\n \tw.Write(b)\n }\n \n+// handleLog checks the node_id parameter and if it matches that of the current\n+// node, returns the local log entries. Otherwise, it looks up the specified\n+// node in gossip and if it exists, sends a request directly to the node to get\n+// its logs. It passes all other query parameters along to this new request.\n+func (s *statusServer) handleLogs(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n+\tnodeIDParam := ps.ByName(\"node_id\")\n+\tif len(nodeIDParam) == 0 {\n+\t\ts.handleLocalLog(w, r, ps)\n+\t\treturn\n+\t}\n+\n+\tid, err := strconv.ParseInt(nodeIDParam, 10, 64)\n+\tif err != nil {\n+\t\tw.WriteHeader(http.StatusBadRequest)\n+\t\tfmt.Fprintf(w, \"node id could not be parsed:%s\", err)\n+\t\treturn\n+\t}\n+\tnodeID := proto.NodeID(id)\n+\n+\tif s.gossip.GetNodeID() == nodeID {\n+\t\ts.handleLocalLog(w, r, ps)\n+\t\treturn\n+\t}\n+\n+\taddr, err := s.gossip.GetNodeIDAddress(nodeID)\n+\tif err != nil {\n+\t\tw.WriteHeader(http.StatusBadRequest)\n+\t\tfmt.Fprint(w, \"could not locate node\")\n+\t\treturn\n+\t}","path":"server/status.go","position":148,"original_position":148,"commit_id":"580cac9e840590b2ae167f64ea0245dda903c212","original_commit_id":"580cac9e840590b2ae167f64ea0245dda903c212","user":{"login":"mrtracy","id":6969858,"avatar_url":"https://avatars.githubusercontent.com/u/6969858?v=3","gravatar_id":"","url":"https://api.github.com/users/mrtracy","html_url":"https://github.com/mrtracy","followers_url":"https://api.github.com/users/mrtracy/followers","following_url":"https://api.github.com/users/mrtracy/following{/other_user}","gists_url":"https://api.github.com/users/mrtracy/gists{/gist_id}","starred_url":"https://api.github.com/users/mrtracy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrtracy/subscriptions","organizations_url":"https://api.github.com/users/mrtracy/orgs","repos_url":"https://api.github.com/users/mrtracy/repos","events_url":"https://api.github.com/users/mrtracy/events{/privacy}","received_events_url":"https://api.github.com/users/mrtracy/received_events","type":"User","site_admin":false},"body":"Can you factor out everything below this line into a separate function?  Everything above this makes the decision to redirect, everything below actually performs the redirect - if you factored it out, you could unit test it.","created_at":"2015-07-21T17:36:49Z","updated_at":"2015-07-21T17:36:49Z","html_url":"https://github.com/cockroachdb/cockroach/pull/1744#discussion_r35130449","pull_request_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1744","_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/35130449"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/1744#discussion_r35130449"},"pull_request":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1744"}}},"pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1744","id":40406351,"html_url":"https://github.com/cockroachdb/cockroach/pull/1744","diff_url":"https://github.com/cockroachdb/cockroach/pull/1744.diff","patch_url":"https://github.com/cockroachdb/cockroach/pull/1744.patch","issue_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/1744","number":1744,"state":"open","locked":false,"title":"Add internal proxying call for log entry retrieval from different nodes.","user":{"login":"BramGruneir","id":1614265,"avatar_url":"https://avatars.githubusercontent.com/u/1614265?v=3","gravatar_id":"","url":"https://api.github.com/users/BramGruneir","html_url":"https://github.com/BramGruneir","followers_url":"https://api.github.com/users/BramGruneir/followers","following_url":"https://api.github.com/users/BramGruneir/following{/other_user}","gists_url":"https://api.github.com/users/BramGruneir/gists{/gist_id}","starred_url":"https://api.github.com/users/BramGruneir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BramGruneir/subscriptions","organizations_url":"https://api.github.com/users/BramGruneir/orgs","repos_url":"https://api.github.com/users/BramGruneir/repos","events_url":"https://api.github.com/users/BramGruneir/events{/privacy}","received_events_url":"https://api.github.com/users/BramGruneir/received_events","type":"User","site_admin":false},"body":"This will break the log listing section in the ui.\r\n\r\nHard to test in our unit testing, might try to make an acceptance test for this.","created_at":"2015-07-20T22:54:31Z","updated_at":"2015-07-21T17:36:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"192c93b87f34957f0135bbec629120a1f7457bd7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1744/commits","review_comments_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1744/comments","review_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/1744/comments","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/580cac9e840590b2ae167f64ea0245dda903c212","head":{"label":"cockroachdb:bram/log-all-nodes","ref":"bram/log-all-nodes","sha":"580cac9e840590b2ae167f64ea0245dda903c212","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":16563587,"name":"cockroach","full_name":"cockroachdb/cockroach","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach","description":"A Scalable, Geo-Replicated, Transactional Datastore","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach","forks_url":"https://api.github.com/repos/cockroachdb/cockroach/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach/releases{/id}","created_at":"2014-02-06T00:18:47Z","updated_at":"2015-07-21T16:45:56Z","pushed_at":"2015-07-21T17:28:50Z","git_url":"git://github.com/cockroachdb/cockroach.git","ssh_url":"git@github.com:cockroachdb/cockroach.git","clone_url":"https://github.com/cockroachdb/cockroach.git","svn_url":"https://github.com/cockroachdb/cockroach","homepage":null,"size":44253,"stargazers_count":4904,"watchers_count":4904,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":377,"mirror_url":null,"open_issues_count":120,"forks":377,"open_issues":120,"watchers":4904,"default_branch":"master"}},"base":{"label":"cockroachdb:master","ref":"master","sha":"58d786a66f15f99da91ac32cc3a613b19eeba8ed","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":16563587,"name":"cockroach","full_name":"cockroachdb/cockroach","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach","description":"A Scalable, Geo-Replicated, Transactional Datastore","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach","forks_url":"https://api.github.com/repos/cockroachdb/cockroach/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach/releases{/id}","created_at":"2014-02-06T00:18:47Z","updated_at":"2015-07-21T16:45:56Z","pushed_at":"2015-07-21T17:28:50Z","git_url":"git://github.com/cockroachdb/cockroach.git","ssh_url":"git@github.com:cockroachdb/cockroach.git","clone_url":"https://github.com/cockroachdb/cockroach.git","svn_url":"https://github.com/cockroachdb/cockroach","homepage":null,"size":44253,"stargazers_count":4904,"watchers_count":4904,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":377,"mirror_url":null,"open_issues_count":120,"forks":377,"open_issues":120,"watchers":4904,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1744"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/1744"},"issue":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/1744"},"comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/1744/comments"},"review_comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1744/comments"},"review_comment":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/1744/commits"},"statuses":{"href":"https://api.github.com/repos/cockroachdb/cockroach/statuses/580cac9e840590b2ae167f64ea0245dda903c212"}}}}