{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/comments/240237465","pull_request_review_id":183212987,"id":240237465,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDIzNzQ2NQ==","diff_hunk":"@@ -0,0 +1,88 @@\n+package sharding\n+\n+import (\n+\t\"crypto/md5\"","path":"pkg/sharding/listwatch.go","position":4,"original_position":4,"commit_id":"d3311faa2d2c67cef5e658396ae77d64b2efce9d","original_commit_id":"d3311faa2d2c67cef5e658396ae77d64b2efce9d","user":{"login":"mxinden","id":7047859,"node_id":"MDQ6VXNlcjcwNDc4NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/7047859?v=4","gravatar_id":"","url":"https://api.github.com/users/mxinden","html_url":"https://github.com/mxinden","followers_url":"https://api.github.com/users/mxinden/followers","following_url":"https://api.github.com/users/mxinden/following{/other_user}","gists_url":"https://api.github.com/users/mxinden/gists{/gist_id}","starred_url":"https://api.github.com/users/mxinden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mxinden/subscriptions","organizations_url":"https://api.github.com/users/mxinden/orgs","repos_url":"https://api.github.com/users/mxinden/repos","events_url":"https://api.github.com/users/mxinden/events{/privacy}","received_events_url":"https://api.github.com/users/mxinden/received_events","type":"User","site_admin":false},"body":"Why use a `crypto` hash function in this context? Wouldn't one of https://golang.org/pkg/hash/ be faster?","created_at":"2018-12-10T14:46:38Z","updated_at":"2018-12-10T14:56:22Z","html_url":"https://github.com/kubernetes/kube-state-metrics/pull/613#discussion_r240237465","pull_request_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/613","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/comments/240237465"},"html":{"href":"https://github.com/kubernetes/kube-state-metrics/pull/613#discussion_r240237465"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/613"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/613","id":237097189,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3MDk3MTg5","html_url":"https://github.com/kubernetes/kube-state-metrics/pull/613","diff_url":"https://github.com/kubernetes/kube-state-metrics/pull/613.diff","patch_url":"https://github.com/kubernetes/kube-state-metrics/pull/613.patch","issue_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/613","number":613,"state":"open","locked":false,"title":"Introduce sharding (and experimental auto-sharding)","user":{"login":"brancz","id":4546722,"node_id":"MDQ6VXNlcjQ1NDY3MjI=","avatar_url":"https://avatars3.githubusercontent.com/u/4546722?v=4","gravatar_id":"","url":"https://api.github.com/users/brancz","html_url":"https://github.com/brancz","followers_url":"https://api.github.com/users/brancz/followers","following_url":"https://api.github.com/users/brancz/following{/other_user}","gists_url":"https://api.github.com/users/brancz/gists{/gist_id}","starred_url":"https://api.github.com/users/brancz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brancz/subscriptions","organizations_url":"https://api.github.com/users/brancz/orgs","repos_url":"https://api.github.com/users/brancz/repos","events_url":"https://api.github.com/users/brancz/events{/privacy}","received_events_url":"https://api.github.com/users/brancz/received_events","type":"User","site_admin":false},"body":"**What this PR does / why we need it**:\r\n\r\nThis PR introduces sharding capabilities for kube-state-metrics, as well as the experimental feature to have kube-state-metrics automatically detect sharding, by discovering its nominal position within a StatefulSet and using the number of replicas in the StatefulSet as the total number of shards. I added a further description of the mechanism to the documentation.\r\n\r\nThese features will allow kube-state-metrics to be easily auto-scaled with the horizontal-pod-autoscaler by using its latency of `/metrics` requests to be lower than a certain threshold, otherwise scaling it up, as the latency is directly related to the amount of objects a shard needs to handle and the more replicas in a setup, the lower the number of objects, therefore a lower latency, as each shard handles 1/nth of objects in the cluster.\r\n\r\nkube-state-metrics is well optimized, but in order to scale it infinitely and on commodity hardware it is necessary to shard the work it needs to do.\r\n\r\nNote, I do not intend to ship these features in the already started release series of 1.5.x of kube-state-metrics, but rather release following it.\r\n\r\n@andyxning @zouyee @mxinden @s-urbaniak @squat @metalmatze ","created_at":"2018-12-08T23:17:28Z","updated_at":"2018-12-10T14:56:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0303c601fe69cf735d9ab163ab82a409d140820e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"andyxning","id":2404712,"node_id":"MDQ6VXNlcjI0MDQ3MTI=","avatar_url":"https://avatars1.githubusercontent.com/u/2404712?v=4","gravatar_id":"","url":"https://api.github.com/users/andyxning","html_url":"https://github.com/andyxning","followers_url":"https://api.github.com/users/andyxning/followers","following_url":"https://api.github.com/users/andyxning/following{/other_user}","gists_url":"https://api.github.com/users/andyxning/gists{/gist_id}","starred_url":"https://api.github.com/users/andyxning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyxning/subscriptions","organizations_url":"https://api.github.com/users/andyxning/orgs","repos_url":"https://api.github.com/users/andyxning/repos","events_url":"https://api.github.com/users/andyxning/events{/privacy}","received_events_url":"https://api.github.com/users/andyxning/received_events","type":"User","site_admin":false},{"login":"zouyee","id":5785605,"node_id":"MDQ6VXNlcjU3ODU2MDU=","avatar_url":"https://avatars2.githubusercontent.com/u/5785605?v=4","gravatar_id":"","url":"https://api.github.com/users/zouyee","html_url":"https://github.com/zouyee","followers_url":"https://api.github.com/users/zouyee/followers","following_url":"https://api.github.com/users/zouyee/following{/other_user}","gists_url":"https://api.github.com/users/zouyee/gists{/gist_id}","starred_url":"https://api.github.com/users/zouyee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zouyee/subscriptions","organizations_url":"https://api.github.com/users/zouyee/orgs","repos_url":"https://api.github.com/users/zouyee/repos","events_url":"https://api.github.com/users/zouyee/events{/privacy}","received_events_url":"https://api.github.com/users/zouyee/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":764086825,"node_id":"MDU6TGFiZWw3NjQwODY4MjU=","url":"https://api.github.com/repos/kubernetes/kube-state-metrics/labels/approved","name":"approved","color":"0ffa16","default":false},{"id":485759093,"node_id":"MDU6TGFiZWw0ODU3NTkwOTM=","url":"https://api.github.com/repos/kubernetes/kube-state-metrics/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":694117710,"node_id":"MDU6TGFiZWw2OTQxMTc3MTA=","url":"https://api.github.com/repos/kubernetes/kube-state-metrics/labels/size/L","name":"size/L","color":"ee9900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/613/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/613/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/613/comments","statuses_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/statuses/d3311faa2d2c67cef5e658396ae77d64b2efce9d","head":{"label":"brancz:sharding","ref":"sharding","sha":"d3311faa2d2c67cef5e658396ae77d64b2efce9d","user":{"login":"brancz","id":4546722,"node_id":"MDQ6VXNlcjQ1NDY3MjI=","avatar_url":"https://avatars3.githubusercontent.com/u/4546722?v=4","gravatar_id":"","url":"https://api.github.com/users/brancz","html_url":"https://github.com/brancz","followers_url":"https://api.github.com/users/brancz/followers","following_url":"https://api.github.com/users/brancz/following{/other_user}","gists_url":"https://api.github.com/users/brancz/gists{/gist_id}","starred_url":"https://api.github.com/users/brancz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brancz/subscriptions","organizations_url":"https://api.github.com/users/brancz/orgs","repos_url":"https://api.github.com/users/brancz/repos","events_url":"https://api.github.com/users/brancz/events{/privacy}","received_events_url":"https://api.github.com/users/brancz/received_events","type":"User","site_admin":false},"repo":{"id":67422303,"node_id":"MDEwOlJlcG9zaXRvcnk2NzQyMjMwMw==","name":"kube-state-metrics","full_name":"brancz/kube-state-metrics","private":false,"owner":{"login":"brancz","id":4546722,"node_id":"MDQ6VXNlcjQ1NDY3MjI=","avatar_url":"https://avatars3.githubusercontent.com/u/4546722?v=4","gravatar_id":"","url":"https://api.github.com/users/brancz","html_url":"https://github.com/brancz","followers_url":"https://api.github.com/users/brancz/followers","following_url":"https://api.github.com/users/brancz/following{/other_user}","gists_url":"https://api.github.com/users/brancz/gists{/gist_id}","starred_url":"https://api.github.com/users/brancz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brancz/subscriptions","organizations_url":"https://api.github.com/users/brancz/orgs","repos_url":"https://api.github.com/users/brancz/repos","events_url":"https://api.github.com/users/brancz/events{/privacy}","received_events_url":"https://api.github.com/users/brancz/received_events","type":"User","site_admin":false},"html_url":"https://github.com/brancz/kube-state-metrics","description":"Add-on agent to generate and expose cluster-level metrics.","fork":true,"url":"https://api.github.com/repos/brancz/kube-state-metrics","forks_url":"https://api.github.com/repos/brancz/kube-state-metrics/forks","keys_url":"https://api.github.com/repos/brancz/kube-state-metrics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brancz/kube-state-metrics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brancz/kube-state-metrics/teams","hooks_url":"https://api.github.com/repos/brancz/kube-state-metrics/hooks","issue_events_url":"https://api.github.com/repos/brancz/kube-state-metrics/issues/events{/number}","events_url":"https://api.github.com/repos/brancz/kube-state-metrics/events","assignees_url":"https://api.github.com/repos/brancz/kube-state-metrics/assignees{/user}","branches_url":"https://api.github.com/repos/brancz/kube-state-metrics/branches{/branch}","tags_url":"https://api.github.com/repos/brancz/kube-state-metrics/tags","blobs_url":"https://api.github.com/repos/brancz/kube-state-metrics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brancz/kube-state-metrics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brancz/kube-state-metrics/git/refs{/sha}","trees_url":"https://api.github.com/repos/brancz/kube-state-metrics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brancz/kube-state-metrics/statuses/{sha}","languages_url":"https://api.github.com/repos/brancz/kube-state-metrics/languages","stargazers_url":"https://api.github.com/repos/brancz/kube-state-metrics/stargazers","contributors_url":"https://api.github.com/repos/brancz/kube-state-metrics/contributors","subscribers_url":"https://api.github.com/repos/brancz/kube-state-metrics/subscribers","subscription_url":"https://api.github.com/repos/brancz/kube-state-metrics/subscription","commits_url":"https://api.github.com/repos/brancz/kube-state-metrics/commits{/sha}","git_commits_url":"https://api.github.com/repos/brancz/kube-state-metrics/git/commits{/sha}","comments_url":"https://api.github.com/repos/brancz/kube-state-metrics/comments{/number}","issue_comment_url":"https://api.github.com/repos/brancz/kube-state-metrics/issues/comments{/number}","contents_url":"https://api.github.com/repos/brancz/kube-state-metrics/contents/{+path}","compare_url":"https://api.github.com/repos/brancz/kube-state-metrics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brancz/kube-state-metrics/merges","archive_url":"https://api.github.com/repos/brancz/kube-state-metrics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brancz/kube-state-metrics/downloads","issues_url":"https://api.github.com/repos/brancz/kube-state-metrics/issues{/number}","pulls_url":"https://api.github.com/repos/brancz/kube-state-metrics/pulls{/number}","milestones_url":"https://api.github.com/repos/brancz/kube-state-metrics/milestones{/number}","notifications_url":"https://api.github.com/repos/brancz/kube-state-metrics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brancz/kube-state-metrics/labels{/name}","releases_url":"https://api.github.com/repos/brancz/kube-state-metrics/releases{/id}","deployments_url":"https://api.github.com/repos/brancz/kube-state-metrics/deployments","created_at":"2016-09-05T13:14:35Z","updated_at":"2016-09-05T13:14:36Z","pushed_at":"2018-12-08T23:05:46Z","git_url":"git://github.com/brancz/kube-state-metrics.git","ssh_url":"git@github.com:brancz/kube-state-metrics.git","clone_url":"https://github.com/brancz/kube-state-metrics.git","svn_url":"https://github.com/brancz/kube-state-metrics","homepage":"","size":10152,"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":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"58683a0e11bd295f1510cc6749435bf18d8bf277","user":{"login":"kubernetes","id":13629408,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNjI5NDA4","avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":58184885,"node_id":"MDEwOlJlcG9zaXRvcnk1ODE4NDg4NQ==","name":"kube-state-metrics","full_name":"kubernetes/kube-state-metrics","private":false,"owner":{"login":"kubernetes","id":13629408,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNjI5NDA4","avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/kubernetes/kube-state-metrics","description":"Add-on agent to generate and expose cluster-level metrics.","fork":false,"url":"https://api.github.com/repos/kubernetes/kube-state-metrics","forks_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/forks","keys_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/teams","hooks_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/events","assignees_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/tags","blobs_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/subscription","commits_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/merges","archive_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/downloads","issues_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/kube-state-metrics/deployments","created_at":"2016-05-06T06:10:13Z","updated_at":"2018-12-10T14:45:50Z","pushed_at":"2018-12-08T23:17:29Z","git_url":"git://github.com/kubernetes/kube-state-metrics.git","ssh_url":"git@github.com:kubernetes/kube-state-metrics.git","clone_url":"https://github.com/kubernetes/kube-state-metrics.git","svn_url":"https://github.com/kubernetes/kube-state-metrics","homepage":"","size":10621,"stargazers_count":1004,"watchers_count":1004,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":307,"mirror_url":null,"archived":false,"open_issues_count":33,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":307,"open_issues":33,"watchers":1004,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/613"},"html":{"href":"https://github.com/kubernetes/kube-state-metrics/pull/613"},"issue":{"href":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/613"},"comments":{"href":"https://api.github.com/repos/kubernetes/kube-state-metrics/issues/613/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/613/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kube-state-metrics/pulls/613/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kube-state-metrics/statuses/d3311faa2d2c67cef5e658396ae77d64b2efce9d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"mxinden"}}