{"action":"created","comment":{"url":"https://api.github.com/repos/getlantern/measured/pulls/comments/64848497","id":64848497,"diff_hunk":"@@ -380,74 +263,35 @@ func (m *Measured) newConn(c net.Conn, interval time.Duration) net.Conn {\n // Read() implements the function from net.Conn\n func (mc *Conn) Read(b []byte) (n int, err error) {\n \tn, err = mc.Conn.Read(b)\n-\tif err != nil {\n-\t\tmc.submitError(err, \"read\")\n-\t}\n \tatomic.AddUint64(&mc.BytesIn, uint64(n))\n \treturn\n }\n \n // Write() implements the function from net.Conn\n func (mc *Conn) Write(b []byte) (n int, err error) {\n \tn, err = mc.Conn.Write(b)\n-\tif err != nil {\n-\t\tmc.submitError(err, \"write\")\n-\t}\n \tatomic.AddUint64(&mc.BytesOut, uint64(n))\n \treturn\n }\n \n // Close implements the function from net.Conn\n func (mc *Conn) Close() (err error) {\n \terr = mc.Conn.Close()\n-\tif err != nil {\n-\t\tmc.submitError(err, \"close\")\n-\t}\n \tmc.submitTraffic()\n \tmc.chStop <- struct{}{}\n \treturn\n }\n \n-func (mc *Conn) submitError(err error, phase string) {\n-\tmc.m.submitError(mc.ID, err, phase)\n-}\n-\n func (mc *Conn) submitTraffic() {\n \tmc.m.submitTraffic(mc.ID,\n \t\tatomic.SwapUint64(&mc.BytesIn, 0),\n \t\tatomic.SwapUint64(&mc.BytesOut, 0))\n }\n \n-func (m *Measured) submitError(connID string, err error, phase string) {\n-\tif atomic.LoadInt32(&m.stopped) == 1 {\n-\t\tlog.Trace(\"Measured stopped, not submitting error\")\n-\t\treturn\n-\t}\n-\tsplitted := strings.Split(err.Error(), \":\")\n-\tlastIndex := len(splitted) - 1\n-\tif lastIndex < 0 {\n-\t\tlastIndex = 0\n-\t}\n-\te := strings.Trim(splitted[lastIndex], \" \")\n-\ter := &Error{\n-\t\tID:    connID,\n-\t\tError: e,\n-\t\tPhase: phase,\n-\t}\n-\tlog.Tracef(\"Submitting error %+v\", er)\n-\tm.chStat <- er\n-}\n-\n-func (m *Measured) submitTraffic(connID string, BytesIn uint64, BytesOut uint64) {\n+func (m *Measured) submitTraffic(connID string, in uint64, out uint64) {\n \tif atomic.LoadInt32(&m.stopped) == 1 {\n \t\tlog.Trace(\"Measured stopped, not submitting traffic\")\n \t\treturn\n \t}\n-\tt := &Traffic{\n-\t\tID:       connID,\n-\t\tBytesIn:  BytesIn,\n-\t\tBytesOut: BytesOut,\n-\t}\n-\tlog.Tracef(\"Submitting traffic %+v\", t)\n-\tm.chStat <- t\n+\tm.trackTraffic(connID, in, out)","path":"measured.go","position":430,"original_position":430,"commit_id":"73a577cfe3d382a80306e9c3d5535a7e839f8b2a","original_commit_id":"73a577cfe3d382a80306e9c3d5535a7e839f8b2a","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":"If we are concerned about this, the solution is to introduce a 2nd goroutine that's continuously calculating the summaries in parallel to them being submitted.","created_at":"2016-05-27T02:04:41Z","updated_at":"2016-05-27T02:04:41Z","html_url":"https://github.com/getlantern/measured/pull/9#discussion_r64848497","pull_request_url":"https://api.github.com/repos/getlantern/measured/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/getlantern/measured/pulls/comments/64848497"},"html":{"href":"https://github.com/getlantern/measured/pull/9#discussion_r64848497"},"pull_request":{"href":"https://api.github.com/repos/getlantern/measured/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/getlantern/measured/pulls/9","id":71650127,"html_url":"https://github.com/getlantern/measured/pull/9","diff_url":"https://github.com/getlantern/measured/pull/9.diff","patch_url":"https://github.com/getlantern/measured/pull/9.patch","issue_url":"https://api.github.com/repos/getlantern/measured/issues/9","number":9,"state":"open","locked":false,"title":"Only tracking traffic, blocking on reporting of traffic, summarizing …","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":"…traffic on the fly, fixed race condition in test\r\n\r\ncc: @uaalto @myleshorton \r\n\r\n* I took out latency reporting because we weren't actually measuring latency in here.\r\n* I took out error reporting since we'll be doing that with borda anyway and this simplified things\r\n* I'm now summarizing data on the fly to save memory.  That did require me to drop the 95th percentile stat, but we aren't using that right now anyway.  In addition to saving memory, this simplified the code I think.\r\n* There was a race condition in the test related to printing the TrafficTracker.  I fixed that by just taking out the String() method, which seemed unnecessary.\r\n* I added a maxBufferDepth setting to limit how many device ID's we're willing to buffer before they get reported.\r\n\r\nIn terms of what we're tracking, the only thing that functionally changed is that if our reporters start taking longer than 1 minute to report, our run loop will block.  That should address the issue of piling up reporters when Redis is timing out, for example.  It does also mean that our aggregated statistics will include more than 1 minute of data, but for what we're tracking right (just totals over time) that doesn't matter.","created_at":"2016-05-27T01:55:20Z","updated_at":"2016-05-27T02:04:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4baffa99c5a890901f6742ff351bd8b9e8449af8","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/measured/pulls/9/commits","review_comments_url":"https://api.github.com/repos/getlantern/measured/pulls/9/comments","review_comment_url":"https://api.github.com/repos/getlantern/measured/pulls/comments{/number}","comments_url":"https://api.github.com/repos/getlantern/measured/issues/9/comments","statuses_url":"https://api.github.com/repos/getlantern/measured/statuses/73a577cfe3d382a80306e9c3d5535a7e839f8b2a","head":{"label":"getlantern:simplifiedperf","ref":"simplifiedperf","sha":"73a577cfe3d382a80306e9c3d5535a7e839f8b2a","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":41072538,"name":"measured","full_name":"getlantern/measured","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/measured","description":"Wraps a dialer to measure the delay, throughput and errors of a connection","fork":false,"url":"https://api.github.com/repos/getlantern/measured","forks_url":"https://api.github.com/repos/getlantern/measured/forks","keys_url":"https://api.github.com/repos/getlantern/measured/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getlantern/measured/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getlantern/measured/teams","hooks_url":"https://api.github.com/repos/getlantern/measured/hooks","issue_events_url":"https://api.github.com/repos/getlantern/measured/issues/events{/number}","events_url":"https://api.github.com/repos/getlantern/measured/events","assignees_url":"https://api.github.com/repos/getlantern/measured/assignees{/user}","branches_url":"https://api.github.com/repos/getlantern/measured/branches{/branch}","tags_url":"https://api.github.com/repos/getlantern/measured/tags","blobs_url":"https://api.github.com/repos/getlantern/measured/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getlantern/measured/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getlantern/measured/git/refs{/sha}","trees_url":"https://api.github.com/repos/getlantern/measured/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getlantern/measured/statuses/{sha}","languages_url":"https://api.github.com/repos/getlantern/measured/languages","stargazers_url":"https://api.github.com/repos/getlantern/measured/stargazers","contributors_url":"https://api.github.com/repos/getlantern/measured/contributors","subscribers_url":"https://api.github.com/repos/getlantern/measured/subscribers","subscription_url":"https://api.github.com/repos/getlantern/measured/subscription","commits_url":"https://api.github.com/repos/getlantern/measured/commits{/sha}","git_commits_url":"https://api.github.com/repos/getlantern/measured/git/commits{/sha}","comments_url":"https://api.github.com/repos/getlantern/measured/comments{/number}","issue_comment_url":"https://api.github.com/repos/getlantern/measured/issues/comments{/number}","contents_url":"https://api.github.com/repos/getlantern/measured/contents/{+path}","compare_url":"https://api.github.com/repos/getlantern/measured/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getlantern/measured/merges","archive_url":"https://api.github.com/repos/getlantern/measured/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getlantern/measured/downloads","issues_url":"https://api.github.com/repos/getlantern/measured/issues{/number}","pulls_url":"https://api.github.com/repos/getlantern/measured/pulls{/number}","milestones_url":"https://api.github.com/repos/getlantern/measured/milestones{/number}","notifications_url":"https://api.github.com/repos/getlantern/measured/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getlantern/measured/labels{/name}","releases_url":"https://api.github.com/repos/getlantern/measured/releases{/id}","deployments_url":"https://api.github.com/repos/getlantern/measured/deployments","created_at":"2015-08-20T03:06:48Z","updated_at":"2016-02-25T13:13:51Z","pushed_at":"2016-05-27T01:55:20Z","git_url":"git://github.com/getlantern/measured.git","ssh_url":"git@github.com:getlantern/measured.git","clone_url":"https://github.com/getlantern/measured.git","svn_url":"https://github.com/getlantern/measured","homepage":null,"size":59,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":4,"default_branch":"master"}},"base":{"label":"getlantern:master","ref":"master","sha":"330fce73f0d1e2210801767745b5d0afcbc50a61","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":41072538,"name":"measured","full_name":"getlantern/measured","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/measured","description":"Wraps a dialer to measure the delay, throughput and errors of a connection","fork":false,"url":"https://api.github.com/repos/getlantern/measured","forks_url":"https://api.github.com/repos/getlantern/measured/forks","keys_url":"https://api.github.com/repos/getlantern/measured/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getlantern/measured/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getlantern/measured/teams","hooks_url":"https://api.github.com/repos/getlantern/measured/hooks","issue_events_url":"https://api.github.com/repos/getlantern/measured/issues/events{/number}","events_url":"https://api.github.com/repos/getlantern/measured/events","assignees_url":"https://api.github.com/repos/getlantern/measured/assignees{/user}","branches_url":"https://api.github.com/repos/getlantern/measured/branches{/branch}","tags_url":"https://api.github.com/repos/getlantern/measured/tags","blobs_url":"https://api.github.com/repos/getlantern/measured/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getlantern/measured/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getlantern/measured/git/refs{/sha}","trees_url":"https://api.github.com/repos/getlantern/measured/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getlantern/measured/statuses/{sha}","languages_url":"https://api.github.com/repos/getlantern/measured/languages","stargazers_url":"https://api.github.com/repos/getlantern/measured/stargazers","contributors_url":"https://api.github.com/repos/getlantern/measured/contributors","subscribers_url":"https://api.github.com/repos/getlantern/measured/subscribers","subscription_url":"https://api.github.com/repos/getlantern/measured/subscription","commits_url":"https://api.github.com/repos/getlantern/measured/commits{/sha}","git_commits_url":"https://api.github.com/repos/getlantern/measured/git/commits{/sha}","comments_url":"https://api.github.com/repos/getlantern/measured/comments{/number}","issue_comment_url":"https://api.github.com/repos/getlantern/measured/issues/comments{/number}","contents_url":"https://api.github.com/repos/getlantern/measured/contents/{+path}","compare_url":"https://api.github.com/repos/getlantern/measured/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getlantern/measured/merges","archive_url":"https://api.github.com/repos/getlantern/measured/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getlantern/measured/downloads","issues_url":"https://api.github.com/repos/getlantern/measured/issues{/number}","pulls_url":"https://api.github.com/repos/getlantern/measured/pulls{/number}","milestones_url":"https://api.github.com/repos/getlantern/measured/milestones{/number}","notifications_url":"https://api.github.com/repos/getlantern/measured/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getlantern/measured/labels{/name}","releases_url":"https://api.github.com/repos/getlantern/measured/releases{/id}","deployments_url":"https://api.github.com/repos/getlantern/measured/deployments","created_at":"2015-08-20T03:06:48Z","updated_at":"2016-02-25T13:13:51Z","pushed_at":"2016-05-27T01:55:20Z","git_url":"git://github.com/getlantern/measured.git","ssh_url":"git@github.com:getlantern/measured.git","clone_url":"https://github.com/getlantern/measured.git","svn_url":"https://github.com/getlantern/measured","homepage":null,"size":59,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/getlantern/measured/pulls/9"},"html":{"href":"https://github.com/getlantern/measured/pull/9"},"issue":{"href":"https://api.github.com/repos/getlantern/measured/issues/9"},"comments":{"href":"https://api.github.com/repos/getlantern/measured/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/getlantern/measured/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/getlantern/measured/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/getlantern/measured/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/getlantern/measured/statuses/73a577cfe3d382a80306e9c3d5535a7e839f8b2a"}}}}
{"actor":{"display_login":"oxtoacart"}}