{"action":"created","comment":{"url":"https://api.github.com/repos/weaveworks/cortex/pulls/comments/166315299","pull_request_review_id":94355743,"id":166315299,"diff_hunk":"@@ -0,0 +1,55 @@\n+package ring\n+\n+import (\n+\t\"fmt\"\n+\t\"time\"\n+)\n+\n+func (r *Ring) replicationStrategy(ingesters []*IngesterDesc) (","path":"pkg/ring/replication_strategy.go","position":8,"original_position":8,"commit_id":"f36d7d607d795d017b1a4f27b20c701f85cf87f8","original_commit_id":"f36d7d607d795d017b1a4f27b20c701f85cf87f8","user":{"login":"bboreham","id":8125524,"avatar_url":"https://avatars2.githubusercontent.com/u/8125524?v=4","gravatar_id":"","url":"https://api.github.com/users/bboreham","html_url":"https://github.com/bboreham","followers_url":"https://api.github.com/users/bboreham/followers","following_url":"https://api.github.com/users/bboreham/following{/other_user}","gists_url":"https://api.github.com/users/bboreham/gists{/gist_id}","starred_url":"https://api.github.com/users/bboreham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bboreham/subscriptions","organizations_url":"https://api.github.com/users/bboreham/orgs","repos_url":"https://api.github.com/users/bboreham/repos","events_url":"https://api.github.com/users/bboreham/events{/privacy}","received_events_url":"https://api.github.com/users/bboreham/received_events","type":"User","site_admin":false},"body":"please explain what the overall purpose of this function is, and what the `ingesters` parameter should contain","created_at":"2018-02-06T14:23:22Z","updated_at":"2018-02-06T14:32:01Z","html_url":"https://github.com/weaveworks/cortex/pull/681#discussion_r166315299","pull_request_url":"https://api.github.com/repos/weaveworks/cortex/pulls/681","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/weaveworks/cortex/pulls/comments/166315299"},"html":{"href":"https://github.com/weaveworks/cortex/pull/681#discussion_r166315299"},"pull_request":{"href":"https://api.github.com/repos/weaveworks/cortex/pulls/681"}}},"pull_request":{"url":"https://api.github.com/repos/weaveworks/cortex/pulls/681","id":166762100,"html_url":"https://github.com/weaveworks/cortex/pull/681","diff_url":"https://github.com/weaveworks/cortex/pull/681.diff","patch_url":"https://github.com/weaveworks/cortex/pull/681.patch","issue_url":"https://api.github.com/repos/weaveworks/cortex/issues/681","number":681,"state":"open","locked":false,"title":"Unify the replication calculation between query and push.","user":{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars1.githubusercontent.com/u/444037?v=4","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false},"body":"Part of #604\r\n\r\nThe logic for doing replication was subtlety different on the query side and on the push side - push used the number of ingesters returned to calculate quorum, and query used the replication factor.  Using the replication factor to calculate quorum will occasionally give the wrong answer when ingesters are joining and leaving.  Whats more, there were a bunch of checks on the push path that weren't on the query path.\r\n\r\nThis PR unifies the logic between these two paths, effectively adding a bunch of checks on the query path and dealing with the case where you have less ingesters than the replication factor (by returning an appropriate error).","created_at":"2018-02-02T10:06:48Z","updated_at":"2018-02-06T14:32:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"181984b652f709963ed4e281ad8cf93d5783f28c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/weaveworks/cortex/pulls/681/commits","review_comments_url":"https://api.github.com/repos/weaveworks/cortex/pulls/681/comments","review_comment_url":"https://api.github.com/repos/weaveworks/cortex/pulls/comments{/number}","comments_url":"https://api.github.com/repos/weaveworks/cortex/issues/681/comments","statuses_url":"https://api.github.com/repos/weaveworks/cortex/statuses/f36d7d607d795d017b1a4f27b20c701f85cf87f8","head":{"label":"kausalco:604-unify-replication-calcs","ref":"604-unify-replication-calcs","sha":"f36d7d607d795d017b1a4f27b20c701f85cf87f8","user":{"login":"kausalco","id":28934852,"avatar_url":"https://avatars3.githubusercontent.com/u/28934852?v=4","gravatar_id":"","url":"https://api.github.com/users/kausalco","html_url":"https://github.com/kausalco","followers_url":"https://api.github.com/users/kausalco/followers","following_url":"https://api.github.com/users/kausalco/following{/other_user}","gists_url":"https://api.github.com/users/kausalco/gists{/gist_id}","starred_url":"https://api.github.com/users/kausalco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kausalco/subscriptions","organizations_url":"https://api.github.com/users/kausalco/orgs","repos_url":"https://api.github.com/users/kausalco/repos","events_url":"https://api.github.com/users/kausalco/events{/privacy}","received_events_url":"https://api.github.com/users/kausalco/received_events","type":"Organization","site_admin":false},"repo":{"id":119964899,"name":"cortex","full_name":"kausalco/cortex","owner":{"login":"kausalco","id":28934852,"avatar_url":"https://avatars3.githubusercontent.com/u/28934852?v=4","gravatar_id":"","url":"https://api.github.com/users/kausalco","html_url":"https://github.com/kausalco","followers_url":"https://api.github.com/users/kausalco/followers","following_url":"https://api.github.com/users/kausalco/following{/other_user}","gists_url":"https://api.github.com/users/kausalco/gists{/gist_id}","starred_url":"https://api.github.com/users/kausalco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kausalco/subscriptions","organizations_url":"https://api.github.com/users/kausalco/orgs","repos_url":"https://api.github.com/users/kausalco/repos","events_url":"https://api.github.com/users/kausalco/events{/privacy}","received_events_url":"https://api.github.com/users/kausalco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kausalco/cortex","description":"A multitenant, horizontally scalable Prometheus as a Service","fork":true,"url":"https://api.github.com/repos/kausalco/cortex","forks_url":"https://api.github.com/repos/kausalco/cortex/forks","keys_url":"https://api.github.com/repos/kausalco/cortex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kausalco/cortex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kausalco/cortex/teams","hooks_url":"https://api.github.com/repos/kausalco/cortex/hooks","issue_events_url":"https://api.github.com/repos/kausalco/cortex/issues/events{/number}","events_url":"https://api.github.com/repos/kausalco/cortex/events","assignees_url":"https://api.github.com/repos/kausalco/cortex/assignees{/user}","branches_url":"https://api.github.com/repos/kausalco/cortex/branches{/branch}","tags_url":"https://api.github.com/repos/kausalco/cortex/tags","blobs_url":"https://api.github.com/repos/kausalco/cortex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kausalco/cortex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kausalco/cortex/git/refs{/sha}","trees_url":"https://api.github.com/repos/kausalco/cortex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kausalco/cortex/statuses/{sha}","languages_url":"https://api.github.com/repos/kausalco/cortex/languages","stargazers_url":"https://api.github.com/repos/kausalco/cortex/stargazers","contributors_url":"https://api.github.com/repos/kausalco/cortex/contributors","subscribers_url":"https://api.github.com/repos/kausalco/cortex/subscribers","subscription_url":"https://api.github.com/repos/kausalco/cortex/subscription","commits_url":"https://api.github.com/repos/kausalco/cortex/commits{/sha}","git_commits_url":"https://api.github.com/repos/kausalco/cortex/git/commits{/sha}","comments_url":"https://api.github.com/repos/kausalco/cortex/comments{/number}","issue_comment_url":"https://api.github.com/repos/kausalco/cortex/issues/comments{/number}","contents_url":"https://api.github.com/repos/kausalco/cortex/contents/{+path}","compare_url":"https://api.github.com/repos/kausalco/cortex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kausalco/cortex/merges","archive_url":"https://api.github.com/repos/kausalco/cortex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kausalco/cortex/downloads","issues_url":"https://api.github.com/repos/kausalco/cortex/issues{/number}","pulls_url":"https://api.github.com/repos/kausalco/cortex/pulls{/number}","milestones_url":"https://api.github.com/repos/kausalco/cortex/milestones{/number}","notifications_url":"https://api.github.com/repos/kausalco/cortex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kausalco/cortex/labels{/name}","releases_url":"https://api.github.com/repos/kausalco/cortex/releases{/id}","deployments_url":"https://api.github.com/repos/kausalco/cortex/deployments","created_at":"2018-02-02T10:00:04Z","updated_at":"2018-02-02T10:00:07Z","pushed_at":"2018-02-06T12:15:56Z","git_url":"git://github.com/kausalco/cortex.git","ssh_url":"git@github.com:kausalco/cortex.git","clone_url":"https://github.com/kausalco/cortex.git","svn_url":"https://github.com/kausalco/cortex","homepage":null,"size":23123,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"weaveworks:master","ref":"master","sha":"b292164f4288e4041bcc44e66771d4fe4dbfbece","user":{"login":"weaveworks","id":9976052,"avatar_url":"https://avatars1.githubusercontent.com/u/9976052?v=4","gravatar_id":"","url":"https://api.github.com/users/weaveworks","html_url":"https://github.com/weaveworks","followers_url":"https://api.github.com/users/weaveworks/followers","following_url":"https://api.github.com/users/weaveworks/following{/other_user}","gists_url":"https://api.github.com/users/weaveworks/gists{/gist_id}","starred_url":"https://api.github.com/users/weaveworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaveworks/subscriptions","organizations_url":"https://api.github.com/users/weaveworks/orgs","repos_url":"https://api.github.com/users/weaveworks/repos","events_url":"https://api.github.com/users/weaveworks/events{/privacy}","received_events_url":"https://api.github.com/users/weaveworks/received_events","type":"Organization","site_admin":false},"repo":{"id":67793333,"name":"cortex","full_name":"weaveworks/cortex","owner":{"login":"weaveworks","id":9976052,"avatar_url":"https://avatars1.githubusercontent.com/u/9976052?v=4","gravatar_id":"","url":"https://api.github.com/users/weaveworks","html_url":"https://github.com/weaveworks","followers_url":"https://api.github.com/users/weaveworks/followers","following_url":"https://api.github.com/users/weaveworks/following{/other_user}","gists_url":"https://api.github.com/users/weaveworks/gists{/gist_id}","starred_url":"https://api.github.com/users/weaveworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaveworks/subscriptions","organizations_url":"https://api.github.com/users/weaveworks/orgs","repos_url":"https://api.github.com/users/weaveworks/repos","events_url":"https://api.github.com/users/weaveworks/events{/privacy}","received_events_url":"https://api.github.com/users/weaveworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/weaveworks/cortex","description":"A multitenant, horizontally scalable Prometheus as a Service","fork":false,"url":"https://api.github.com/repos/weaveworks/cortex","forks_url":"https://api.github.com/repos/weaveworks/cortex/forks","keys_url":"https://api.github.com/repos/weaveworks/cortex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/weaveworks/cortex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/weaveworks/cortex/teams","hooks_url":"https://api.github.com/repos/weaveworks/cortex/hooks","issue_events_url":"https://api.github.com/repos/weaveworks/cortex/issues/events{/number}","events_url":"https://api.github.com/repos/weaveworks/cortex/events","assignees_url":"https://api.github.com/repos/weaveworks/cortex/assignees{/user}","branches_url":"https://api.github.com/repos/weaveworks/cortex/branches{/branch}","tags_url":"https://api.github.com/repos/weaveworks/cortex/tags","blobs_url":"https://api.github.com/repos/weaveworks/cortex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/weaveworks/cortex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/weaveworks/cortex/git/refs{/sha}","trees_url":"https://api.github.com/repos/weaveworks/cortex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/weaveworks/cortex/statuses/{sha}","languages_url":"https://api.github.com/repos/weaveworks/cortex/languages","stargazers_url":"https://api.github.com/repos/weaveworks/cortex/stargazers","contributors_url":"https://api.github.com/repos/weaveworks/cortex/contributors","subscribers_url":"https://api.github.com/repos/weaveworks/cortex/subscribers","subscription_url":"https://api.github.com/repos/weaveworks/cortex/subscription","commits_url":"https://api.github.com/repos/weaveworks/cortex/commits{/sha}","git_commits_url":"https://api.github.com/repos/weaveworks/cortex/git/commits{/sha}","comments_url":"https://api.github.com/repos/weaveworks/cortex/comments{/number}","issue_comment_url":"https://api.github.com/repos/weaveworks/cortex/issues/comments{/number}","contents_url":"https://api.github.com/repos/weaveworks/cortex/contents/{+path}","compare_url":"https://api.github.com/repos/weaveworks/cortex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/weaveworks/cortex/merges","archive_url":"https://api.github.com/repos/weaveworks/cortex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/weaveworks/cortex/downloads","issues_url":"https://api.github.com/repos/weaveworks/cortex/issues{/number}","pulls_url":"https://api.github.com/repos/weaveworks/cortex/pulls{/number}","milestones_url":"https://api.github.com/repos/weaveworks/cortex/milestones{/number}","notifications_url":"https://api.github.com/repos/weaveworks/cortex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/weaveworks/cortex/labels{/name}","releases_url":"https://api.github.com/repos/weaveworks/cortex/releases{/id}","deployments_url":"https://api.github.com/repos/weaveworks/cortex/deployments","created_at":"2016-09-09T11:23:12Z","updated_at":"2018-02-05T13:39:13Z","pushed_at":"2018-02-06T13:48:14Z","git_url":"git://github.com/weaveworks/cortex.git","ssh_url":"git@github.com:weaveworks/cortex.git","clone_url":"https://github.com/weaveworks/cortex.git","svn_url":"https://github.com/weaveworks/cortex","homepage":null,"size":79641,"stargazers_count":400,"watchers_count":400,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":43,"mirror_url":null,"archived":false,"open_issues_count":107,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":43,"open_issues":107,"watchers":400,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/weaveworks/cortex/pulls/681"},"html":{"href":"https://github.com/weaveworks/cortex/pull/681"},"issue":{"href":"https://api.github.com/repos/weaveworks/cortex/issues/681"},"comments":{"href":"https://api.github.com/repos/weaveworks/cortex/issues/681/comments"},"review_comments":{"href":"https://api.github.com/repos/weaveworks/cortex/pulls/681/comments"},"review_comment":{"href":"https://api.github.com/repos/weaveworks/cortex/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/weaveworks/cortex/pulls/681/commits"},"statuses":{"href":"https://api.github.com/repos/weaveworks/cortex/statuses/f36d7d607d795d017b1a4f27b20c701f85cf87f8"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"bboreham"}}