{"action":"created","comment":{"url":"https://api.github.com/repos/getlantern/lantern/pulls/comments/66005197","id":66005197,"diff_hunk":"@@ -0,0 +1,246 @@\n+package borda\n+\n+import (\n+\t\"fmt\"\n+\t\"math\"\n+\t\"net/http\"\n+\t\"time\"\n+\n+\t\"github.com/getlantern/eventual\"\n+\t\"github.com/golang/glog\"\n+\t\"github.com/influxdata/influxdb/client/v2\"\n+)\n+\n+// Measurement represents a measurement at a point in time. It maps to a \"point\"\n+// in InfluxDB.\n+type Measurement struct {\n+\t// Name is the name of the measurement (e.g. cpu_usage). It maps to the \"key\"\n+\t// in \"InfluxDB\".\n+\tName string `json:\"name\"`\n+\n+\t// Ts records the time of the measurement.\n+\tTs time.Time `json:\"ts,omitempty\"`\n+\n+\t// Values contains numeric values of the measurement. These will be stored as\n+\t// \"fields\" in InfluxDB.\n+\t//\n+\t// Example: { \"num_errors\": 67 }\n+\tValues map[string]float64 `json:\"values,omitempty\"`\n+\n+\t// Dimensions captures key/value pairs which characterize the measurement.\n+\t// Dimensions are stored as \"tags\" or \"fields\" in InfluxDB depending on which\n+\t// dimensions have been configured as \"IndexedDimensions\" on the Collector.\n+\t//\n+\t// Example: { \"requestid\": \"18af517b-004f-486c-9978-6cf60be7f1e9\",\n+\t//            \"ipv6\": \"2001:0db8:0a0b:12f0:0000:0000:0000:0001\",\n+\t//            \"host\": \"myhost.mydomain.com\",\n+\t//            \"total_cpus\": \"2\",\n+\t//            \"cpu_idle\": 10.1,\n+\t//            \"cpu_system\": 53.3,\n+\t//            \"cpu_user\": 36.6,\n+\t//            \"connected_to_internet\": true }\n+\tDimensions map[string]interface{} `json:\"dimensions,omitempty\"`\n+}\n+\n+// WriteFunc is a function that writes a batch to the database\n+type WriteFunc func(client.BatchPoints) error\n+\n+// Collector collects Measurements\n+type Collector interface {\n+\thttp.Handler","path":"src/github.com/getlantern/borda/borda.go","position":50,"original_position":50,"commit_id":"963ca00aaf5ab71857667de2e9618e080f3a646d","original_commit_id":"963ca00aaf5ab71857667de2e9618e080f3a646d","user":{"login":"fffw","id":10410437,"avatar_url":"https://avatars.githubusercontent.com/u/10410437?v=3","gravatar_id":"","url":"https://api.github.com/users/fffw","html_url":"https://github.com/fffw","followers_url":"https://api.github.com/users/fffw/followers","following_url":"https://api.github.com/users/fffw/following{/other_user}","gists_url":"https://api.github.com/users/fffw/gists{/gist_id}","starred_url":"https://api.github.com/users/fffw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fffw/subscriptions","organizations_url":"https://api.github.com/users/fffw/orgs","repos_url":"https://api.github.com/users/fffw/repos","events_url":"https://api.github.com/users/fffw/events{/privacy}","received_events_url":"https://api.github.com/users/fffw/received_events","type":"User","site_admin":false},"body":"It would be better to comment here why it embeds `http.Handler`","created_at":"2016-06-07T03:27:31Z","updated_at":"2016-06-07T03:27:31Z","html_url":"https://github.com/getlantern/lantern/pull/4363#discussion_r66005197","pull_request_url":"https://api.github.com/repos/getlantern/lantern/pulls/4363","_links":{"self":{"href":"https://api.github.com/repos/getlantern/lantern/pulls/comments/66005197"},"html":{"href":"https://github.com/getlantern/lantern/pull/4363#discussion_r66005197"},"pull_request":{"href":"https://api.github.com/repos/getlantern/lantern/pulls/4363"}}},"pull_request":{"url":"https://api.github.com/repos/getlantern/lantern/pulls/4363","id":71275330,"html_url":"https://github.com/getlantern/lantern/pull/4363","diff_url":"https://github.com/getlantern/lantern/pull/4363.diff","patch_url":"https://github.com/getlantern/lantern/pull/4363.patch","issue_url":"https://api.github.com/repos/getlantern/lantern/issues/4363","number":4363,"state":"open","locked":false,"title":"Final borda/error reporting PR","user":{"login":"oxtoacart","id":5000654,"avatar_url":"https://avatars.githubusercontent.com/u/5000654?v=3","gravatar_id":"","url":"https://api.github.com/users/oxtoacart","html_url":"https://github.com/oxtoacart","followers_url":"https://api.github.com/users/oxtoacart/followers","following_url":"https://api.github.com/users/oxtoacart/following{/other_user}","gists_url":"https://api.github.com/users/oxtoacart/gists{/gist_id}","starred_url":"https://api.github.com/users/oxtoacart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oxtoacart/subscriptions","organizations_url":"https://api.github.com/users/oxtoacart/orgs","repos_url":"https://api.github.com/users/oxtoacart/repos","events_url":"https://api.github.com/users/oxtoacart/events{/privacy}","received_events_url":"https://api.github.com/users/oxtoacart/received_events","type":"User","site_admin":false},"body":"Really, I mean it this time!\r\n\r\nHere's what we have:\r\n\r\n* errors package is used to provide nice errors with contextual information and stack traces\r\n* golog package now shows stacktraces when available\r\n* context package is used to provide general context\r\n* ops package (which wraps context) is used to track nested operations like proxy -> dial chained and record whether or not they failed to borda\r\n* borda/client provides a client that sends pre-aggregated, rate-limited measurements to the borda server\r\n\r\nUnlike the previous version of this, reporting to borda does not go through golog because after discussing with @uaalto, we realized that borda is not a log aggregator like Loggly but rather a health metrics monitoring system.\r\n\r\nThere's a related server-side PR - https://github.com/getlantern/http-proxy-lantern/pull/77.  These can be merged independently, but the most interesting data comes from having both in play.","created_at":"2016-05-24T19:06:30Z","updated_at":"2016-06-07T03:27:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"86b304879d09fce1d23c7aea183dc8a41ecd1357","assignee":{"login":"fffw","id":10410437,"avatar_url":"https://avatars.githubusercontent.com/u/10410437?v=3","gravatar_id":"","url":"https://api.github.com/users/fffw","html_url":"https://github.com/fffw","followers_url":"https://api.github.com/users/fffw/followers","following_url":"https://api.github.com/users/fffw/following{/other_user}","gists_url":"https://api.github.com/users/fffw/gists{/gist_id}","starred_url":"https://api.github.com/users/fffw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fffw/subscriptions","organizations_url":"https://api.github.com/users/fffw/orgs","repos_url":"https://api.github.com/users/fffw/repos","events_url":"https://api.github.com/users/fffw/events{/privacy}","received_events_url":"https://api.github.com/users/fffw/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/getlantern/lantern/pulls/4363/commits","review_comments_url":"https://api.github.com/repos/getlantern/lantern/pulls/4363/comments","review_comment_url":"https://api.github.com/repos/getlantern/lantern/pulls/comments{/number}","comments_url":"https://api.github.com/repos/getlantern/lantern/issues/4363/comments","statuses_url":"https://api.github.com/repos/getlantern/lantern/statuses/963ca00aaf5ab71857667de2e9618e080f3a646d","head":{"label":"getlantern:ops","ref":"ops","sha":"963ca00aaf5ab71857667de2e9618e080f3a646d","user":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"repo":{"id":1380117,"name":"lantern","full_name":"getlantern/lantern","owner":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getlantern/lantern","description":":zap: Open Internet for everyone. Lantern is a free desktop application that delivers fast, reliable and secure access to the open Internet for users in censored regions. It uses a variety of techniques to stay unblocked, including P2P and domain fronting. Lantern relies on users in uncensored regions acting as access points to the open Internet.","fork":false,"url":"https://api.github.com/repos/getlantern/lantern","forks_url":"https://api.github.com/repos/getlantern/lantern/forks","keys_url":"https://api.github.com/repos/getlantern/lantern/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getlantern/lantern/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getlantern/lantern/teams","hooks_url":"https://api.github.com/repos/getlantern/lantern/hooks","issue_events_url":"https://api.github.com/repos/getlantern/lantern/issues/events{/number}","events_url":"https://api.github.com/repos/getlantern/lantern/events","assignees_url":"https://api.github.com/repos/getlantern/lantern/assignees{/user}","branches_url":"https://api.github.com/repos/getlantern/lantern/branches{/branch}","tags_url":"https://api.github.com/repos/getlantern/lantern/tags","blobs_url":"https://api.github.com/repos/getlantern/lantern/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getlantern/lantern/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getlantern/lantern/git/refs{/sha}","trees_url":"https://api.github.com/repos/getlantern/lantern/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getlantern/lantern/statuses/{sha}","languages_url":"https://api.github.com/repos/getlantern/lantern/languages","stargazers_url":"https://api.github.com/repos/getlantern/lantern/stargazers","contributors_url":"https://api.github.com/repos/getlantern/lantern/contributors","subscribers_url":"https://api.github.com/repos/getlantern/lantern/subscribers","subscription_url":"https://api.github.com/repos/getlantern/lantern/subscription","commits_url":"https://api.github.com/repos/getlantern/lantern/commits{/sha}","git_commits_url":"https://api.github.com/repos/getlantern/lantern/git/commits{/sha}","comments_url":"https://api.github.com/repos/getlantern/lantern/comments{/number}","issue_comment_url":"https://api.github.com/repos/getlantern/lantern/issues/comments{/number}","contents_url":"https://api.github.com/repos/getlantern/lantern/contents/{+path}","compare_url":"https://api.github.com/repos/getlantern/lantern/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getlantern/lantern/merges","archive_url":"https://api.github.com/repos/getlantern/lantern/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getlantern/lantern/downloads","issues_url":"https://api.github.com/repos/getlantern/lantern/issues{/number}","pulls_url":"https://api.github.com/repos/getlantern/lantern/pulls{/number}","milestones_url":"https://api.github.com/repos/getlantern/lantern/milestones{/number}","notifications_url":"https://api.github.com/repos/getlantern/lantern/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getlantern/lantern/labels{/name}","releases_url":"https://api.github.com/repos/getlantern/lantern/releases{/id}","deployments_url":"https://api.github.com/repos/getlantern/lantern/deployments","created_at":"2011-02-17T22:12:29Z","updated_at":"2016-06-07T03:25:02Z","pushed_at":"2016-06-07T02:44:53Z","git_url":"git://github.com/getlantern/lantern.git","ssh_url":"git@github.com:getlantern/lantern.git","clone_url":"https://github.com/getlantern/lantern.git","svn_url":"https://github.com/getlantern/lantern","homepage":"https://getlantern.org","size":1226454,"stargazers_count":16698,"watchers_count":16698,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4342,"mirror_url":null,"open_issues_count":500,"forks":4342,"open_issues":500,"watchers":16698,"default_branch":"devel"}},"base":{"label":"getlantern:devel","ref":"devel","sha":"1eecf18071140f743dbfaf1ec040ebe61b8b2bf3","user":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"repo":{"id":1380117,"name":"lantern","full_name":"getlantern/lantern","owner":{"login":"getlantern","id":624178,"avatar_url":"https://avatars.githubusercontent.com/u/624178?v=3","gravatar_id":"","url":"https://api.github.com/users/getlantern","html_url":"https://github.com/getlantern","followers_url":"https://api.github.com/users/getlantern/followers","following_url":"https://api.github.com/users/getlantern/following{/other_user}","gists_url":"https://api.github.com/users/getlantern/gists{/gist_id}","starred_url":"https://api.github.com/users/getlantern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getlantern/subscriptions","organizations_url":"https://api.github.com/users/getlantern/orgs","repos_url":"https://api.github.com/users/getlantern/repos","events_url":"https://api.github.com/users/getlantern/events{/privacy}","received_events_url":"https://api.github.com/users/getlantern/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getlantern/lantern","description":":zap: Open Internet for everyone. Lantern is a free desktop application that delivers fast, reliable and secure access to the open Internet for users in censored regions. It uses a variety of techniques to stay unblocked, including P2P and domain fronting. Lantern relies on users in uncensored regions acting as access points to the open Internet.","fork":false,"url":"https://api.github.com/repos/getlantern/lantern","forks_url":"https://api.github.com/repos/getlantern/lantern/forks","keys_url":"https://api.github.com/repos/getlantern/lantern/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getlantern/lantern/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getlantern/lantern/teams","hooks_url":"https://api.github.com/repos/getlantern/lantern/hooks","issue_events_url":"https://api.github.com/repos/getlantern/lantern/issues/events{/number}","events_url":"https://api.github.com/repos/getlantern/lantern/events","assignees_url":"https://api.github.com/repos/getlantern/lantern/assignees{/user}","branches_url":"https://api.github.com/repos/getlantern/lantern/branches{/branch}","tags_url":"https://api.github.com/repos/getlantern/lantern/tags","blobs_url":"https://api.github.com/repos/getlantern/lantern/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getlantern/lantern/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getlantern/lantern/git/refs{/sha}","trees_url":"https://api.github.com/repos/getlantern/lantern/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getlantern/lantern/statuses/{sha}","languages_url":"https://api.github.com/repos/getlantern/lantern/languages","stargazers_url":"https://api.github.com/repos/getlantern/lantern/stargazers","contributors_url":"https://api.github.com/repos/getlantern/lantern/contributors","subscribers_url":"https://api.github.com/repos/getlantern/lantern/subscribers","subscription_url":"https://api.github.com/repos/getlantern/lantern/subscription","commits_url":"https://api.github.com/repos/getlantern/lantern/commits{/sha}","git_commits_url":"https://api.github.com/repos/getlantern/lantern/git/commits{/sha}","comments_url":"https://api.github.com/repos/getlantern/lantern/comments{/number}","issue_comment_url":"https://api.github.com/repos/getlantern/lantern/issues/comments{/number}","contents_url":"https://api.github.com/repos/getlantern/lantern/contents/{+path}","compare_url":"https://api.github.com/repos/getlantern/lantern/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getlantern/lantern/merges","archive_url":"https://api.github.com/repos/getlantern/lantern/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getlantern/lantern/downloads","issues_url":"https://api.github.com/repos/getlantern/lantern/issues{/number}","pulls_url":"https://api.github.com/repos/getlantern/lantern/pulls{/number}","milestones_url":"https://api.github.com/repos/getlantern/lantern/milestones{/number}","notifications_url":"https://api.github.com/repos/getlantern/lantern/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getlantern/lantern/labels{/name}","releases_url":"https://api.github.com/repos/getlantern/lantern/releases{/id}","deployments_url":"https://api.github.com/repos/getlantern/lantern/deployments","created_at":"2011-02-17T22:12:29Z","updated_at":"2016-06-07T03:25:02Z","pushed_at":"2016-06-07T02:44:53Z","git_url":"git://github.com/getlantern/lantern.git","ssh_url":"git@github.com:getlantern/lantern.git","clone_url":"https://github.com/getlantern/lantern.git","svn_url":"https://github.com/getlantern/lantern","homepage":"https://getlantern.org","size":1226454,"stargazers_count":16698,"watchers_count":16698,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4342,"mirror_url":null,"open_issues_count":500,"forks":4342,"open_issues":500,"watchers":16698,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/getlantern/lantern/pulls/4363"},"html":{"href":"https://github.com/getlantern/lantern/pull/4363"},"issue":{"href":"https://api.github.com/repos/getlantern/lantern/issues/4363"},"comments":{"href":"https://api.github.com/repos/getlantern/lantern/issues/4363/comments"},"review_comments":{"href":"https://api.github.com/repos/getlantern/lantern/pulls/4363/comments"},"review_comment":{"href":"https://api.github.com/repos/getlantern/lantern/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/getlantern/lantern/pulls/4363/commits"},"statuses":{"href":"https://api.github.com/repos/getlantern/lantern/statuses/963ca00aaf5ab71857667de2e9618e080f3a646d"}}}}
{"actor":{"display_login":"fffw"}}