{"action":"created","issue":{"url":"https://api.github.com/repos/mperham/sidekiq/issues/2851","repository_url":"https://api.github.com/repos/mperham/sidekiq","labels_url":"https://api.github.com/repos/mperham/sidekiq/issues/2851/labels{/name}","comments_url":"https://api.github.com/repos/mperham/sidekiq/issues/2851/comments","events_url":"https://api.github.com/repos/mperham/sidekiq/issues/2851/events","html_url":"https://github.com/mperham/sidekiq/pull/2851","id":136534027,"number":2851,"title":"Added Sidekiq#redis_info to encapsulate info calls","user":{"login":"lwe","id":83660,"avatar_url":"https://avatars.githubusercontent.com/u/83660?v=3","gravatar_id":"","url":"https://api.github.com/users/lwe","html_url":"https://github.com/lwe","followers_url":"https://api.github.com/users/lwe/followers","following_url":"https://api.github.com/users/lwe/following{/other_user}","gists_url":"https://api.github.com/users/lwe/gists{/gist_id}","starred_url":"https://api.github.com/users/lwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lwe/subscriptions","organizations_url":"https://api.github.com/users/lwe/orgs","repos_url":"https://api.github.com/users/lwe/repos","events_url":"https://api.github.com/users/lwe/events{/privacy}","received_events_url":"https://api.github.com/users/lwe/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-02-25T22:40:40Z","updated_at":"2016-02-26T07:19:41Z","closed_at":"2016-02-25T23:33:08Z","pull_request":{"url":"https://api.github.com/repos/mperham/sidekiq/pulls/2851","html_url":"https://github.com/mperham/sidekiq/pull/2851","diff_url":"https://github.com/mperham/sidekiq/pull/2851.diff","patch_url":"https://github.com/mperham/sidekiq/pull/2851.patch"},"body":"As discussed in #2850 this adds the method `redis_info` to `Sidekiq`, to allow easier monkey patching for servers that disable `INFO`.\r\n\r\n\r\n### Open items\r\n\r\n-  [x] Had to use `Sidekiq.redis_info` and was not able to write it in `Utils.redis_info`, as the `Utils` are not included in the WebHelpers, okay?\r\n- [x] Don't know sidekiq / redis enough, but is the call to `redis.info` for `:namespace` actually required, I've only seen `web_helpers.rb` actually using it like that\r\n- [x] Added a test to check that the call to `redis_info` returns a few keys, maybe we should test more keys or specific values - or are there any keys that return a fixed value in tests?\r\n\r\n### Proposal for a monkey-patch-free-version...\r\n\r\nOne more thing, if possible I'd really like to change `self.redis_info` to the following, but I agree that having to support all crazy redis configuration variants might not really be viable.\r\n\r\n```ruby\r\n  def self.redis_info\r\n    redis do |conn|\r\n      begin\r\n        # admin commands can't go through redis-namespace starting\r\n        # in redis-namespace 2.0\r\n        if conn.respond_to?(:namespace)\r\n          conn.redis.info\r\n        else\r\n          conn.info\r\n        end\r\n      rescue Redis::CommandError => ex\r\n        # 2850 assume redis 2.8 when INFO has been renamed\r\n        raise unless ex.message =~ /Unknown command/\r\n        { 'redis_version' => '2.8' }\r\n      end\r\n    end\r\n  end\r\n```\r\n\r\nOtherwise is it possible to add this to the wiki, or where would be the place to add a \"supported\" monkeypatch? Maybe on https://github.com/mperham/sidekiq/wiki/Problems-and-Troubleshooting, can I freely edit this page?"},"comment":{"url":"https://api.github.com/repos/mperham/sidekiq/issues/comments/189143950","html_url":"https://github.com/mperham/sidekiq/pull/2851#issuecomment-189143950","issue_url":"https://api.github.com/repos/mperham/sidekiq/issues/2851","id":189143950,"user":{"login":"lwe","id":83660,"avatar_url":"https://avatars.githubusercontent.com/u/83660?v=3","gravatar_id":"","url":"https://api.github.com/users/lwe","html_url":"https://github.com/lwe","followers_url":"https://api.github.com/users/lwe/followers","following_url":"https://api.github.com/users/lwe/following{/other_user}","gists_url":"https://api.github.com/users/lwe/gists{/gist_id}","starred_url":"https://api.github.com/users/lwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lwe/subscriptions","organizations_url":"https://api.github.com/users/lwe/orgs","repos_url":"https://api.github.com/users/lwe/repos","events_url":"https://api.github.com/users/lwe/events{/privacy}","received_events_url":"https://api.github.com/users/lwe/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T07:19:41Z","updated_at":"2016-02-26T07:19:41Z","body":":ok_hand: you are welcome."}}