{"action":"created","comment":{"url":"https://api.github.com/repos/payout/rester/pulls/comments/50289176","id":50289176,"diff_hunk":"@@ -92,28 +95,47 @@ def _init_requester\n         ) { |*args| _request(*args) }\n \n         @_requester.on_open do\n-          logger.error(\"circuit opened\")\n+          _log_with_correlation_id(:error, \"circuit opened for #{_producer_name}\")\n         end\n \n         @_requester.on_close do\n-          logger.info(\"circuit closed\")\n+          _log_with_correlation_id(:info, \"circuit closed for #{_producer_name}\")\n         end\n       else\n         @_requester = proc { |*args| _request(*args) }\n       end\n     end\n \n+    ##\n+    # Add a correlation ID to the header and send the request to the adapter\n     def _request(verb, path, params)\n-      path = _path_with_version(path)\n-      _process_response(path, *adapter.request(verb, path, params))\n+      _set_default_headers\n+      _log_req_res(:request, verb, path)\n+      _process_response(verb, path, *adapter.request(verb, path, params))\n+    end\n+\n+    def _set_default_headers\n+      adapter.headers(\n+        'X-Rester-Correlation-ID' => Rester.correlation_id,\n+        'X-Rester-Consumer-Name' => Rester.service_name,\n+        'X-Rester-Producer-Name' => _producer_name\n+      )\n+    end\n+\n+    def _producer_name\n+      @_producer_name ||= \"Producer\"","path":"lib/rester/client.rb","position":88,"original_position":88,"commit_id":"9c068250fd41c7938799fe9c7b3c9c68d152d57c","original_commit_id":"9c068250fd41c7938799fe9c7b3c9c68d152d57c","user":{"login":"roberthoner","id":4632927,"avatar_url":"https://avatars.githubusercontent.com/u/4632927?v=3","gravatar_id":"","url":"https://api.github.com/users/roberthoner","html_url":"https://github.com/roberthoner","followers_url":"https://api.github.com/users/roberthoner/followers","following_url":"https://api.github.com/users/roberthoner/following{/other_user}","gists_url":"https://api.github.com/users/roberthoner/gists{/gist_id}","starred_url":"https://api.github.com/users/roberthoner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roberthoner/subscriptions","organizations_url":"https://api.github.com/users/roberthoner/orgs","repos_url":"https://api.github.com/users/roberthoner/repos","events_url":"https://api.github.com/users/roberthoner/events{/privacy}","received_events_url":"https://api.github.com/users/roberthoner/received_events","type":"User","site_admin":false},"body":"Since we're pinging the service on connect to get the producer name, I feel like if this is nil, we should let it be nil instead of defaulting it to `Producer`.  If someone ever saw a `nil` producer name, it'd be clearer that the producer name wasn't being set, but if it said `Producer` people might go on a wild goose chase to figure out where that was being set.","created_at":"2016-01-20T17:37:16Z","updated_at":"2016-01-20T17:37:16Z","html_url":"https://github.com/payout/rester/pull/83#discussion_r50289176","pull_request_url":"https://api.github.com/repos/payout/rester/pulls/83","_links":{"self":{"href":"https://api.github.com/repos/payout/rester/pulls/comments/50289176"},"html":{"href":"https://github.com/payout/rester/pull/83#discussion_r50289176"},"pull_request":{"href":"https://api.github.com/repos/payout/rester/pulls/83"}}},"pull_request":{"url":"https://api.github.com/repos/payout/rester/pulls/83","id":56121087,"html_url":"https://github.com/payout/rester/pull/83","diff_url":"https://github.com/payout/rester/pull/83.diff","patch_url":"https://github.com/payout/rester/pull/83.patch","issue_url":"https://api.github.com/repos/payout/rester/issues/83","number":83,"state":"open","locked":false,"title":"Add support for receiving and passing on correlation IDs","user":{"login":"kayvonghaffari","id":8127158,"avatar_url":"https://avatars.githubusercontent.com/u/8127158?v=3","gravatar_id":"","url":"https://api.github.com/users/kayvonghaffari","html_url":"https://github.com/kayvonghaffari","followers_url":"https://api.github.com/users/kayvonghaffari/followers","following_url":"https://api.github.com/users/kayvonghaffari/following{/other_user}","gists_url":"https://api.github.com/users/kayvonghaffari/gists{/gist_id}","starred_url":"https://api.github.com/users/kayvonghaffari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kayvonghaffari/subscriptions","organizations_url":"https://api.github.com/users/kayvonghaffari/orgs","repos_url":"https://api.github.com/users/kayvonghaffari/repos","events_url":"https://api.github.com/users/kayvonghaffari/events{/privacy}","received_events_url":"https://api.github.com/users/kayvonghaffari/received_events","type":"User","site_admin":false},"body":"[#24]","created_at":"2016-01-15T01:48:39Z","updated_at":"2016-01-20T17:37:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"20c2dfc28d32bd2d7b16698d14118d6ef2e85215","assignee":{"login":"roberthoner","id":4632927,"avatar_url":"https://avatars.githubusercontent.com/u/4632927?v=3","gravatar_id":"","url":"https://api.github.com/users/roberthoner","html_url":"https://github.com/roberthoner","followers_url":"https://api.github.com/users/roberthoner/followers","following_url":"https://api.github.com/users/roberthoner/following{/other_user}","gists_url":"https://api.github.com/users/roberthoner/gists{/gist_id}","starred_url":"https://api.github.com/users/roberthoner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roberthoner/subscriptions","organizations_url":"https://api.github.com/users/roberthoner/orgs","repos_url":"https://api.github.com/users/roberthoner/repos","events_url":"https://api.github.com/users/roberthoner/events{/privacy}","received_events_url":"https://api.github.com/users/roberthoner/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/payout/rester/milestones/14","html_url":"https://github.com/payout/rester/milestones/0.5.2","labels_url":"https://api.github.com/repos/payout/rester/milestones/14/labels","id":1498040,"number":14,"title":"0.5.2","description":"","creator":{"login":"roberthoner","id":4632927,"avatar_url":"https://avatars.githubusercontent.com/u/4632927?v=3","gravatar_id":"","url":"https://api.github.com/users/roberthoner","html_url":"https://github.com/roberthoner","followers_url":"https://api.github.com/users/roberthoner/followers","following_url":"https://api.github.com/users/roberthoner/following{/other_user}","gists_url":"https://api.github.com/users/roberthoner/gists{/gist_id}","starred_url":"https://api.github.com/users/roberthoner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roberthoner/subscriptions","organizations_url":"https://api.github.com/users/roberthoner/orgs","repos_url":"https://api.github.com/users/roberthoner/repos","events_url":"https://api.github.com/users/roberthoner/events{/privacy}","received_events_url":"https://api.github.com/users/roberthoner/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":2,"state":"open","created_at":"2016-01-11T19:12:26Z","updated_at":"2016-01-18T18:28:34Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/payout/rester/pulls/83/commits","review_comments_url":"https://api.github.com/repos/payout/rester/pulls/83/comments","review_comment_url":"https://api.github.com/repos/payout/rester/pulls/comments{/number}","comments_url":"https://api.github.com/repos/payout/rester/issues/83/comments","statuses_url":"https://api.github.com/repos/payout/rester/statuses/9c068250fd41c7938799fe9c7b3c9c68d152d57c","head":{"label":"payout:issue/24","ref":"issue/24","sha":"9c068250fd41c7938799fe9c7b3c9c68d152d57c","user":{"login":"payout","id":1719238,"avatar_url":"https://avatars.githubusercontent.com/u/1719238?v=3","gravatar_id":"","url":"https://api.github.com/users/payout","html_url":"https://github.com/payout","followers_url":"https://api.github.com/users/payout/followers","following_url":"https://api.github.com/users/payout/following{/other_user}","gists_url":"https://api.github.com/users/payout/gists{/gist_id}","starred_url":"https://api.github.com/users/payout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/payout/subscriptions","organizations_url":"https://api.github.com/users/payout/orgs","repos_url":"https://api.github.com/users/payout/repos","events_url":"https://api.github.com/users/payout/events{/privacy}","received_events_url":"https://api.github.com/users/payout/received_events","type":"Organization","site_admin":false},"repo":{"id":43285081,"name":"rester","full_name":"payout/rester","owner":{"login":"payout","id":1719238,"avatar_url":"https://avatars.githubusercontent.com/u/1719238?v=3","gravatar_id":"","url":"https://api.github.com/users/payout","html_url":"https://github.com/payout","followers_url":"https://api.github.com/users/payout/followers","following_url":"https://api.github.com/users/payout/following{/other_user}","gists_url":"https://api.github.com/users/payout/gists{/gist_id}","starred_url":"https://api.github.com/users/payout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/payout/subscriptions","organizations_url":"https://api.github.com/users/payout/orgs","repos_url":"https://api.github.com/users/payout/repos","events_url":"https://api.github.com/users/payout/events{/privacy}","received_events_url":"https://api.github.com/users/payout/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/payout/rester","description":"An exceedingly quick way of creating restful interfaces between Ruby services.","fork":false,"url":"https://api.github.com/repos/payout/rester","forks_url":"https://api.github.com/repos/payout/rester/forks","keys_url":"https://api.github.com/repos/payout/rester/keys{/key_id}","collaborators_url":"https://api.github.com/repos/payout/rester/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/payout/rester/teams","hooks_url":"https://api.github.com/repos/payout/rester/hooks","issue_events_url":"https://api.github.com/repos/payout/rester/issues/events{/number}","events_url":"https://api.github.com/repos/payout/rester/events","assignees_url":"https://api.github.com/repos/payout/rester/assignees{/user}","branches_url":"https://api.github.com/repos/payout/rester/branches{/branch}","tags_url":"https://api.github.com/repos/payout/rester/tags","blobs_url":"https://api.github.com/repos/payout/rester/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/payout/rester/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/payout/rester/git/refs{/sha}","trees_url":"https://api.github.com/repos/payout/rester/git/trees{/sha}","statuses_url":"https://api.github.com/repos/payout/rester/statuses/{sha}","languages_url":"https://api.github.com/repos/payout/rester/languages","stargazers_url":"https://api.github.com/repos/payout/rester/stargazers","contributors_url":"https://api.github.com/repos/payout/rester/contributors","subscribers_url":"https://api.github.com/repos/payout/rester/subscribers","subscription_url":"https://api.github.com/repos/payout/rester/subscription","commits_url":"https://api.github.com/repos/payout/rester/commits{/sha}","git_commits_url":"https://api.github.com/repos/payout/rester/git/commits{/sha}","comments_url":"https://api.github.com/repos/payout/rester/comments{/number}","issue_comment_url":"https://api.github.com/repos/payout/rester/issues/comments{/number}","contents_url":"https://api.github.com/repos/payout/rester/contents/{+path}","compare_url":"https://api.github.com/repos/payout/rester/compare/{base}...{head}","merges_url":"https://api.github.com/repos/payout/rester/merges","archive_url":"https://api.github.com/repos/payout/rester/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/payout/rester/downloads","issues_url":"https://api.github.com/repos/payout/rester/issues{/number}","pulls_url":"https://api.github.com/repos/payout/rester/pulls{/number}","milestones_url":"https://api.github.com/repos/payout/rester/milestones{/number}","notifications_url":"https://api.github.com/repos/payout/rester/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/payout/rester/labels{/name}","releases_url":"https://api.github.com/repos/payout/rester/releases{/id}","created_at":"2015-09-28T06:59:28Z","updated_at":"2016-01-13T23:49:47Z","pushed_at":"2016-01-20T01:19:51Z","git_url":"git://github.com/payout/rester.git","ssh_url":"git@github.com:payout/rester.git","clone_url":"https://github.com/payout/rester.git","svn_url":"https://github.com/payout/rester","homepage":"","size":337,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":2,"default_branch":"master"}},"base":{"label":"payout:master","ref":"master","sha":"6be471ede5016b0ddaf2c316fe24ccdd70408d31","user":{"login":"payout","id":1719238,"avatar_url":"https://avatars.githubusercontent.com/u/1719238?v=3","gravatar_id":"","url":"https://api.github.com/users/payout","html_url":"https://github.com/payout","followers_url":"https://api.github.com/users/payout/followers","following_url":"https://api.github.com/users/payout/following{/other_user}","gists_url":"https://api.github.com/users/payout/gists{/gist_id}","starred_url":"https://api.github.com/users/payout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/payout/subscriptions","organizations_url":"https://api.github.com/users/payout/orgs","repos_url":"https://api.github.com/users/payout/repos","events_url":"https://api.github.com/users/payout/events{/privacy}","received_events_url":"https://api.github.com/users/payout/received_events","type":"Organization","site_admin":false},"repo":{"id":43285081,"name":"rester","full_name":"payout/rester","owner":{"login":"payout","id":1719238,"avatar_url":"https://avatars.githubusercontent.com/u/1719238?v=3","gravatar_id":"","url":"https://api.github.com/users/payout","html_url":"https://github.com/payout","followers_url":"https://api.github.com/users/payout/followers","following_url":"https://api.github.com/users/payout/following{/other_user}","gists_url":"https://api.github.com/users/payout/gists{/gist_id}","starred_url":"https://api.github.com/users/payout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/payout/subscriptions","organizations_url":"https://api.github.com/users/payout/orgs","repos_url":"https://api.github.com/users/payout/repos","events_url":"https://api.github.com/users/payout/events{/privacy}","received_events_url":"https://api.github.com/users/payout/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/payout/rester","description":"An exceedingly quick way of creating restful interfaces between Ruby services.","fork":false,"url":"https://api.github.com/repos/payout/rester","forks_url":"https://api.github.com/repos/payout/rester/forks","keys_url":"https://api.github.com/repos/payout/rester/keys{/key_id}","collaborators_url":"https://api.github.com/repos/payout/rester/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/payout/rester/teams","hooks_url":"https://api.github.com/repos/payout/rester/hooks","issue_events_url":"https://api.github.com/repos/payout/rester/issues/events{/number}","events_url":"https://api.github.com/repos/payout/rester/events","assignees_url":"https://api.github.com/repos/payout/rester/assignees{/user}","branches_url":"https://api.github.com/repos/payout/rester/branches{/branch}","tags_url":"https://api.github.com/repos/payout/rester/tags","blobs_url":"https://api.github.com/repos/payout/rester/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/payout/rester/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/payout/rester/git/refs{/sha}","trees_url":"https://api.github.com/repos/payout/rester/git/trees{/sha}","statuses_url":"https://api.github.com/repos/payout/rester/statuses/{sha}","languages_url":"https://api.github.com/repos/payout/rester/languages","stargazers_url":"https://api.github.com/repos/payout/rester/stargazers","contributors_url":"https://api.github.com/repos/payout/rester/contributors","subscribers_url":"https://api.github.com/repos/payout/rester/subscribers","subscription_url":"https://api.github.com/repos/payout/rester/subscription","commits_url":"https://api.github.com/repos/payout/rester/commits{/sha}","git_commits_url":"https://api.github.com/repos/payout/rester/git/commits{/sha}","comments_url":"https://api.github.com/repos/payout/rester/comments{/number}","issue_comment_url":"https://api.github.com/repos/payout/rester/issues/comments{/number}","contents_url":"https://api.github.com/repos/payout/rester/contents/{+path}","compare_url":"https://api.github.com/repos/payout/rester/compare/{base}...{head}","merges_url":"https://api.github.com/repos/payout/rester/merges","archive_url":"https://api.github.com/repos/payout/rester/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/payout/rester/downloads","issues_url":"https://api.github.com/repos/payout/rester/issues{/number}","pulls_url":"https://api.github.com/repos/payout/rester/pulls{/number}","milestones_url":"https://api.github.com/repos/payout/rester/milestones{/number}","notifications_url":"https://api.github.com/repos/payout/rester/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/payout/rester/labels{/name}","releases_url":"https://api.github.com/repos/payout/rester/releases{/id}","created_at":"2015-09-28T06:59:28Z","updated_at":"2016-01-13T23:49:47Z","pushed_at":"2016-01-20T01:19:51Z","git_url":"git://github.com/payout/rester.git","ssh_url":"git@github.com:payout/rester.git","clone_url":"https://github.com/payout/rester.git","svn_url":"https://github.com/payout/rester","homepage":"","size":337,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/payout/rester/pulls/83"},"html":{"href":"https://github.com/payout/rester/pull/83"},"issue":{"href":"https://api.github.com/repos/payout/rester/issues/83"},"comments":{"href":"https://api.github.com/repos/payout/rester/issues/83/comments"},"review_comments":{"href":"https://api.github.com/repos/payout/rester/pulls/83/comments"},"review_comment":{"href":"https://api.github.com/repos/payout/rester/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/payout/rester/pulls/83/commits"},"statuses":{"href":"https://api.github.com/repos/payout/rester/statuses/9c068250fd41c7938799fe9c7b3c9c68d152d57c"}}}}