{"action":"created","comment":{"url":"https://api.github.com/repos/Yelp/fullerite/pulls/comments/45969480","id":45969480,"diff_hunk":"@@ -0,0 +1,50 @@\n+package util\n+\n+import (\n+\t\"errors\"\n+\t\"net\"\n+)\n+\n+// DI\n+var (\n+\tinterfaces = net.Interfaces\n+\tgetAddrs   = (*net.Interface).Addrs\n+)\n+\n+// ExternalIP Provides the string representation of the IP address of the box.\n+func ExternalIP() (string, error) {\n+\tifaces, err := interfaces()\n+\tif err != nil {\n+\t\treturn \"\", err\n+\t}\n+\tfor _, iface := range ifaces {\n+\t\tif iface.Flags&net.FlagUp == 0 {\n+\t\t\tcontinue // interface down\n+\t\t}\n+\t\tif iface.Flags&net.FlagLoopback != 0 {\n+\t\t\tcontinue // loopback interface\n+\t\t}\n+\t\taddrs, err := getAddrs(&iface)\n+\t\tif err != nil {\n+\t\t\treturn \"\", err\n+\t\t}\n+\t\tfor _, addr := range addrs {\n+\t\t\tvar ip net.IP\n+\t\t\tswitch v := addr.(type) {\n+\t\t\tcase *net.IPNet:\n+\t\t\t\tip = v.IP\n+\t\t\tcase *net.IPAddr:\n+\t\t\t\tip = v.IP\n+\t\t\t}\n+\t\t\tif ip == nil || ip.IsLoopback() {\n+\t\t\t\tcontinue\n+\t\t\t}\n+\t\t\tip = ip.To4()\n+\t\t\tif ip == nil {\n+\t\t\t\tcontinue // not an ipv4 address\n+\t\t\t}\n+\t\t\treturn ip.String(), nil\n+\t\t}\n+\t}\n+\treturn \"\", errors.New(\"are you connected to the network?\")\n+}","path":"src/fullerite/util/iptools.go","position":50,"original_position":50,"commit_id":"ecf5e1e1eaae50bb7f17942913a676a44a17d183","original_commit_id":"ecf5e1e1eaae50bb7f17942913a676a44a17d183","user":{"login":"avadhutp","id":244408,"avatar_url":"https://avatars.githubusercontent.com/u/244408?v=3","gravatar_id":"","url":"https://api.github.com/users/avadhutp","html_url":"https://github.com/avadhutp","followers_url":"https://api.github.com/users/avadhutp/followers","following_url":"https://api.github.com/users/avadhutp/following{/other_user}","gists_url":"https://api.github.com/users/avadhutp/gists{/gist_id}","starred_url":"https://api.github.com/users/avadhutp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avadhutp/subscriptions","organizations_url":"https://api.github.com/users/avadhutp/orgs","repos_url":"https://api.github.com/users/avadhutp/repos","events_url":"https://api.github.com/users/avadhutp/events{/privacy}","received_events_url":"https://api.github.com/users/avadhutp/received_events","type":"User","site_admin":false},"body":"@tsheasha :smile: Looks very similar. Although the lack of any tests in that package make me not want to include it.","created_at":"2015-11-26T11:34:53Z","updated_at":"2015-11-26T11:34:53Z","html_url":"https://github.com/Yelp/fullerite/pull/94#discussion_r45969480","pull_request_url":"https://api.github.com/repos/Yelp/fullerite/pulls/94","_links":{"self":{"href":"https://api.github.com/repos/Yelp/fullerite/pulls/comments/45969480"},"html":{"href":"https://github.com/Yelp/fullerite/pull/94#discussion_r45969480"},"pull_request":{"href":"https://api.github.com/repos/Yelp/fullerite/pulls/94"}}},"pull_request":{"url":"https://api.github.com/repos/Yelp/fullerite/pulls/94","id":51784445,"html_url":"https://github.com/Yelp/fullerite/pull/94","diff_url":"https://github.com/Yelp/fullerite/pull/94.diff","patch_url":"https://github.com/Yelp/fullerite/pull/94.patch","issue_url":"https://api.github.com/repos/Yelp/fullerite/issues/94","number":94,"state":"open","locked":false,"title":"Mesos collector","user":{"login":"avadhutp","id":244408,"avatar_url":"https://avatars.githubusercontent.com/u/244408?v=3","gravatar_id":"","url":"https://api.github.com/users/avadhutp","html_url":"https://github.com/avadhutp","followers_url":"https://api.github.com/users/avadhutp/followers","following_url":"https://api.github.com/users/avadhutp/following{/other_user}","gists_url":"https://api.github.com/users/avadhutp/gists{/gist_id}","starred_url":"https://api.github.com/users/avadhutp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avadhutp/subscriptions","organizations_url":"https://api.github.com/users/avadhutp/orgs","repos_url":"https://api.github.com/users/avadhutp/repos","events_url":"https://api.github.com/users/avadhutp/events{/privacy}","received_events_url":"https://api.github.com/users/avadhutp/received_events","type":"User","site_admin":false},"body":"## What?\r\n1. New collector for stats from mesos\r\n1. Could not use the old mesos.py collector because it does not identify leader masters (mesos can have multiple masters and one of them is elected as a *leader*; we are interested in metrics only from this instance)\r\n1. We will poll the masters for the leader every 5 mins only. Once we identify the leader, we will cache this value for the next 5 mins. And the collector instance running on that box will send stats. I am yet to confirm the efficacy of this 5 min threshold. I will speak to kwa and figure it out before the review is closed. \r\n1. Will be primarily enabled on PaaSTA masters to enable capacity tracking\r\n\r\n## How?\r\n1. The collector is tolerant enough to not panic in case of malformed config. It will simply log errors and move on.\r\n1. Working config example:\r\n```json\r\n\"collectors\": {\r\n    \"MesosStats\":{\"mesosNodes\":\"http://10.40.1.51:5050/,http://10.40.1.49:5050/,http://10.40.1.50:5050/\"}\r\n},\r\n```\r\n\r\n## How do I know this works?\r\n1. Scores of tests added for all code included in the pull request.\r\n1. Tested this version on devc mesos masters to make sure that the correct metrics are being sent to SignalFx from the correct mesos  master (*leader*).","created_at":"2015-11-25T11:50:47Z","updated_at":"2015-11-26T11:34:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf799ab15fc75195d56a919c51a222a80c94a8dc","assignee":{"login":"zachm","id":229114,"avatar_url":"https://avatars.githubusercontent.com/u/229114?v=3","gravatar_id":"","url":"https://api.github.com/users/zachm","html_url":"https://github.com/zachm","followers_url":"https://api.github.com/users/zachm/followers","following_url":"https://api.github.com/users/zachm/following{/other_user}","gists_url":"https://api.github.com/users/zachm/gists{/gist_id}","starred_url":"https://api.github.com/users/zachm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zachm/subscriptions","organizations_url":"https://api.github.com/users/zachm/orgs","repos_url":"https://api.github.com/users/zachm/repos","events_url":"https://api.github.com/users/zachm/events{/privacy}","received_events_url":"https://api.github.com/users/zachm/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/Yelp/fullerite/pulls/94/commits","review_comments_url":"https://api.github.com/repos/Yelp/fullerite/pulls/94/comments","review_comment_url":"https://api.github.com/repos/Yelp/fullerite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Yelp/fullerite/issues/94/comments","statuses_url":"https://api.github.com/repos/Yelp/fullerite/statuses/ecf5e1e1eaae50bb7f17942913a676a44a17d183","head":{"label":"Yelp:avadhutp_mesos_leader_collector","ref":"avadhutp_mesos_leader_collector","sha":"ecf5e1e1eaae50bb7f17942913a676a44a17d183","user":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"repo":{"id":39368384,"name":"fullerite","full_name":"Yelp/fullerite","owner":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yelp/fullerite","description":"Fullerite is a daemon which collect metrics periodically from various sources and sends them to different metric stores","fork":false,"url":"https://api.github.com/repos/Yelp/fullerite","forks_url":"https://api.github.com/repos/Yelp/fullerite/forks","keys_url":"https://api.github.com/repos/Yelp/fullerite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yelp/fullerite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yelp/fullerite/teams","hooks_url":"https://api.github.com/repos/Yelp/fullerite/hooks","issue_events_url":"https://api.github.com/repos/Yelp/fullerite/issues/events{/number}","events_url":"https://api.github.com/repos/Yelp/fullerite/events","assignees_url":"https://api.github.com/repos/Yelp/fullerite/assignees{/user}","branches_url":"https://api.github.com/repos/Yelp/fullerite/branches{/branch}","tags_url":"https://api.github.com/repos/Yelp/fullerite/tags","blobs_url":"https://api.github.com/repos/Yelp/fullerite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yelp/fullerite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yelp/fullerite/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yelp/fullerite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yelp/fullerite/statuses/{sha}","languages_url":"https://api.github.com/repos/Yelp/fullerite/languages","stargazers_url":"https://api.github.com/repos/Yelp/fullerite/stargazers","contributors_url":"https://api.github.com/repos/Yelp/fullerite/contributors","subscribers_url":"https://api.github.com/repos/Yelp/fullerite/subscribers","subscription_url":"https://api.github.com/repos/Yelp/fullerite/subscription","commits_url":"https://api.github.com/repos/Yelp/fullerite/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yelp/fullerite/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yelp/fullerite/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yelp/fullerite/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yelp/fullerite/contents/{+path}","compare_url":"https://api.github.com/repos/Yelp/fullerite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yelp/fullerite/merges","archive_url":"https://api.github.com/repos/Yelp/fullerite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yelp/fullerite/downloads","issues_url":"https://api.github.com/repos/Yelp/fullerite/issues{/number}","pulls_url":"https://api.github.com/repos/Yelp/fullerite/pulls{/number}","milestones_url":"https://api.github.com/repos/Yelp/fullerite/milestones{/number}","notifications_url":"https://api.github.com/repos/Yelp/fullerite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yelp/fullerite/labels{/name}","releases_url":"https://api.github.com/repos/Yelp/fullerite/releases{/id}","created_at":"2015-07-20T07:01:49Z","updated_at":"2015-11-24T13:41:38Z","pushed_at":"2015-11-25T18:48:01Z","git_url":"git://github.com/Yelp/fullerite.git","ssh_url":"git@github.com:Yelp/fullerite.git","clone_url":"https://github.com/Yelp/fullerite.git","svn_url":"https://github.com/Yelp/fullerite","homepage":"","size":6839,"stargazers_count":101,"watchers_count":101,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":18,"forks":21,"open_issues":18,"watchers":101,"default_branch":"master"}},"base":{"label":"Yelp:master","ref":"master","sha":"16e458c63332900476a14afb0193acdc69a70555","user":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"repo":{"id":39368384,"name":"fullerite","full_name":"Yelp/fullerite","owner":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yelp/fullerite","description":"Fullerite is a daemon which collect metrics periodically from various sources and sends them to different metric stores","fork":false,"url":"https://api.github.com/repos/Yelp/fullerite","forks_url":"https://api.github.com/repos/Yelp/fullerite/forks","keys_url":"https://api.github.com/repos/Yelp/fullerite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yelp/fullerite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yelp/fullerite/teams","hooks_url":"https://api.github.com/repos/Yelp/fullerite/hooks","issue_events_url":"https://api.github.com/repos/Yelp/fullerite/issues/events{/number}","events_url":"https://api.github.com/repos/Yelp/fullerite/events","assignees_url":"https://api.github.com/repos/Yelp/fullerite/assignees{/user}","branches_url":"https://api.github.com/repos/Yelp/fullerite/branches{/branch}","tags_url":"https://api.github.com/repos/Yelp/fullerite/tags","blobs_url":"https://api.github.com/repos/Yelp/fullerite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yelp/fullerite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yelp/fullerite/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yelp/fullerite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yelp/fullerite/statuses/{sha}","languages_url":"https://api.github.com/repos/Yelp/fullerite/languages","stargazers_url":"https://api.github.com/repos/Yelp/fullerite/stargazers","contributors_url":"https://api.github.com/repos/Yelp/fullerite/contributors","subscribers_url":"https://api.github.com/repos/Yelp/fullerite/subscribers","subscription_url":"https://api.github.com/repos/Yelp/fullerite/subscription","commits_url":"https://api.github.com/repos/Yelp/fullerite/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yelp/fullerite/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yelp/fullerite/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yelp/fullerite/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yelp/fullerite/contents/{+path}","compare_url":"https://api.github.com/repos/Yelp/fullerite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yelp/fullerite/merges","archive_url":"https://api.github.com/repos/Yelp/fullerite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yelp/fullerite/downloads","issues_url":"https://api.github.com/repos/Yelp/fullerite/issues{/number}","pulls_url":"https://api.github.com/repos/Yelp/fullerite/pulls{/number}","milestones_url":"https://api.github.com/repos/Yelp/fullerite/milestones{/number}","notifications_url":"https://api.github.com/repos/Yelp/fullerite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yelp/fullerite/labels{/name}","releases_url":"https://api.github.com/repos/Yelp/fullerite/releases{/id}","created_at":"2015-07-20T07:01:49Z","updated_at":"2015-11-24T13:41:38Z","pushed_at":"2015-11-25T18:48:01Z","git_url":"git://github.com/Yelp/fullerite.git","ssh_url":"git@github.com:Yelp/fullerite.git","clone_url":"https://github.com/Yelp/fullerite.git","svn_url":"https://github.com/Yelp/fullerite","homepage":"","size":6839,"stargazers_count":101,"watchers_count":101,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":18,"forks":21,"open_issues":18,"watchers":101,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Yelp/fullerite/pulls/94"},"html":{"href":"https://github.com/Yelp/fullerite/pull/94"},"issue":{"href":"https://api.github.com/repos/Yelp/fullerite/issues/94"},"comments":{"href":"https://api.github.com/repos/Yelp/fullerite/issues/94/comments"},"review_comments":{"href":"https://api.github.com/repos/Yelp/fullerite/pulls/94/comments"},"review_comment":{"href":"https://api.github.com/repos/Yelp/fullerite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Yelp/fullerite/pulls/94/commits"},"statuses":{"href":"https://api.github.com/repos/Yelp/fullerite/statuses/ecf5e1e1eaae50bb7f17942913a676a44a17d183"}}}}