{"action":"created","comment":{"url":"https://api.github.com/repos/Shopify/lhm/pulls/comments/35455561","id":35455561,"diff_hunk":"@@ -1,5 +1,11 @@\n module Lhm\n   module Throttler\n+\n+    def self.format_hosts(hosts)\n+      hosts.map { |host| host.partition(':')[0] }","path":"lib/lhm/throttler/slave_lag.rb","position":5,"original_position":5,"commit_id":"ae94da2fe8d274d06256c1b32483cc1ec1451b3f","original_commit_id":"ae94da2fe8d274d06256c1b32483cc1ec1451b3f","user":{"login":"jordanwheeler","id":2702398,"avatar_url":"https://avatars.githubusercontent.com/u/2702398?v=3","gravatar_id":"","url":"https://api.github.com/users/jordanwheeler","html_url":"https://github.com/jordanwheeler","followers_url":"https://api.github.com/users/jordanwheeler/followers","following_url":"https://api.github.com/users/jordanwheeler/following{/other_user}","gists_url":"https://api.github.com/users/jordanwheeler/gists{/gist_id}","starred_url":"https://api.github.com/users/jordanwheeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordanwheeler/subscriptions","organizations_url":"https://api.github.com/users/jordanwheeler/orgs","repos_url":"https://api.github.com/users/jordanwheeler/repos","events_url":"https://api.github.com/users/jordanwheeler/events{/privacy}","received_events_url":"https://api.github.com/users/jordanwheeler/received_events","type":"User","site_admin":false},"body":"yeah.  i actually just moved this code around so it could be shared, it was already part of `SlaveLag`.","created_at":"2015-07-24T19:03:17Z","updated_at":"2015-07-24T19:03:17Z","html_url":"https://github.com/Shopify/lhm/pull/8#discussion_r35455561","pull_request_url":"https://api.github.com/repos/Shopify/lhm/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/Shopify/lhm/pulls/comments/35455561"},"html":{"href":"https://github.com/Shopify/lhm/pull/8#discussion_r35455561"},"pull_request":{"href":"https://api.github.com/repos/Shopify/lhm/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/Shopify/lhm/pulls/8","id":40507852,"html_url":"https://github.com/Shopify/lhm/pull/8","diff_url":"https://github.com/Shopify/lhm/pull/8.diff","patch_url":"https://github.com/Shopify/lhm/pull/8.patch","issue_url":"https://api.github.com/repos/Shopify/lhm/issues/8","number":8,"state":"open","locked":false,"title":"Throttle based on lag of all slaves in replication chain","user":{"login":"jordanwheeler","id":2702398,"avatar_url":"https://avatars.githubusercontent.com/u/2702398?v=3","gravatar_id":"","url":"https://api.github.com/users/jordanwheeler","html_url":"https://github.com/jordanwheeler","followers_url":"https://api.github.com/users/jordanwheeler/followers","following_url":"https://api.github.com/users/jordanwheeler/following{/other_user}","gists_url":"https://api.github.com/users/jordanwheeler/gists{/gist_id}","starred_url":"https://api.github.com/users/jordanwheeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordanwheeler/subscriptions","organizations_url":"https://api.github.com/users/jordanwheeler/orgs","repos_url":"https://api.github.com/users/jordanwheeler/repos","events_url":"https://api.github.com/users/jordanwheeler/events{/privacy}","received_events_url":"https://api.github.com/users/jordanwheeler/received_events","type":"User","site_admin":false},"body":"This is my slave lag throttler code as compared to soundcloud/lhm master (the `lhm-upstream` branch in this repo).  I've tested it quite a bit with Shopify.  There's some small changes we need to make there to use this (https://github.com/Shopify/shopify/pull/49019), but other than the `logger_params` change I needed to make in that PR, upstream lhm works just fine for us.\r\n\r\nAs I've mentioned, I'm not PRing this upstream because it explicitly uses the `Mysql2::Client`, whereas upstream \"is compatible and continuously tested with MRI 2.0.x, 2.1.x, ActiveRecord 3.2.x and 4.x (mysql and mysql2 adapters).\"  But we're more concerned with throttling slave lag than we are with getting this code upstream right now.\r\n\r\nSo I think the plan right now (pending review) is to merge the `lhm-upstream` branch, merge this, merge my Shopify PR (along with an updated gem ref) then start throttling some slave lag.\r\n\r\n@camilo @arthurnn @jasonhl @shuhaowu ","created_at":"2015-07-21T21:38:24Z","updated_at":"2015-07-24T19:03:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8916d67a3a9113d986dbcdf66a2c67aff5f76083","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Shopify/lhm/pulls/8/commits","review_comments_url":"https://api.github.com/repos/Shopify/lhm/pulls/8/comments","review_comment_url":"https://api.github.com/repos/Shopify/lhm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shopify/lhm/issues/8/comments","statuses_url":"https://api.github.com/repos/Shopify/lhm/statuses/ae94da2fe8d274d06256c1b32483cc1ec1451b3f","head":{"label":"Shopify:slave-lag","ref":"slave-lag","sha":"ae94da2fe8d274d06256c1b32483cc1ec1451b3f","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":15902229,"name":"lhm","full_name":"Shopify/lhm","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/lhm","description":"Online MySQL schema migrations","fork":true,"url":"https://api.github.com/repos/Shopify/lhm","forks_url":"https://api.github.com/repos/Shopify/lhm/forks","keys_url":"https://api.github.com/repos/Shopify/lhm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/lhm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/lhm/teams","hooks_url":"https://api.github.com/repos/Shopify/lhm/hooks","issue_events_url":"https://api.github.com/repos/Shopify/lhm/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/lhm/events","assignees_url":"https://api.github.com/repos/Shopify/lhm/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/lhm/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/lhm/tags","blobs_url":"https://api.github.com/repos/Shopify/lhm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/lhm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/lhm/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/lhm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/lhm/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/lhm/languages","stargazers_url":"https://api.github.com/repos/Shopify/lhm/stargazers","contributors_url":"https://api.github.com/repos/Shopify/lhm/contributors","subscribers_url":"https://api.github.com/repos/Shopify/lhm/subscribers","subscription_url":"https://api.github.com/repos/Shopify/lhm/subscription","commits_url":"https://api.github.com/repos/Shopify/lhm/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/lhm/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/lhm/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/lhm/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/lhm/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/lhm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/lhm/merges","archive_url":"https://api.github.com/repos/Shopify/lhm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/lhm/downloads","issues_url":"https://api.github.com/repos/Shopify/lhm/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/lhm/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/lhm/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/lhm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/lhm/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/lhm/releases{/id}","created_at":"2014-01-14T13:08:57Z","updated_at":"2015-04-21T08:17:00Z","pushed_at":"2015-07-24T15:02:28Z","git_url":"git://github.com/Shopify/lhm.git","ssh_url":"git@github.com:Shopify/lhm.git","clone_url":"https://github.com/Shopify/lhm.git","svn_url":"https://github.com/Shopify/lhm","homepage":"","size":931,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":4,"forks":2,"open_issues":4,"watchers":3,"default_branch":"master"}},"base":{"label":"Shopify:lhm-upstream","ref":"lhm-upstream","sha":"56d30e2fd95d162fa18441e7d02ea8216cc2e7f2","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":15902229,"name":"lhm","full_name":"Shopify/lhm","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/lhm","description":"Online MySQL schema migrations","fork":true,"url":"https://api.github.com/repos/Shopify/lhm","forks_url":"https://api.github.com/repos/Shopify/lhm/forks","keys_url":"https://api.github.com/repos/Shopify/lhm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/lhm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/lhm/teams","hooks_url":"https://api.github.com/repos/Shopify/lhm/hooks","issue_events_url":"https://api.github.com/repos/Shopify/lhm/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/lhm/events","assignees_url":"https://api.github.com/repos/Shopify/lhm/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/lhm/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/lhm/tags","blobs_url":"https://api.github.com/repos/Shopify/lhm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/lhm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/lhm/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/lhm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/lhm/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/lhm/languages","stargazers_url":"https://api.github.com/repos/Shopify/lhm/stargazers","contributors_url":"https://api.github.com/repos/Shopify/lhm/contributors","subscribers_url":"https://api.github.com/repos/Shopify/lhm/subscribers","subscription_url":"https://api.github.com/repos/Shopify/lhm/subscription","commits_url":"https://api.github.com/repos/Shopify/lhm/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/lhm/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/lhm/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/lhm/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/lhm/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/lhm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/lhm/merges","archive_url":"https://api.github.com/repos/Shopify/lhm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/lhm/downloads","issues_url":"https://api.github.com/repos/Shopify/lhm/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/lhm/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/lhm/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/lhm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/lhm/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/lhm/releases{/id}","created_at":"2014-01-14T13:08:57Z","updated_at":"2015-04-21T08:17:00Z","pushed_at":"2015-07-24T15:02:28Z","git_url":"git://github.com/Shopify/lhm.git","ssh_url":"git@github.com:Shopify/lhm.git","clone_url":"https://github.com/Shopify/lhm.git","svn_url":"https://github.com/Shopify/lhm","homepage":"","size":931,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":4,"forks":2,"open_issues":4,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shopify/lhm/pulls/8"},"html":{"href":"https://github.com/Shopify/lhm/pull/8"},"issue":{"href":"https://api.github.com/repos/Shopify/lhm/issues/8"},"comments":{"href":"https://api.github.com/repos/Shopify/lhm/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/Shopify/lhm/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/Shopify/lhm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shopify/lhm/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/Shopify/lhm/statuses/ae94da2fe8d274d06256c1b32483cc1ec1451b3f"}}}}