{"action":"created","comment":{"url":"https://api.github.com/repos/zendesk/radar/pulls/comments/44553158","id":44553158,"diff_hunk":"@@ -296,20 +296,41 @@ Server.prototype._authorizeMessage = function(socket, message, messageType) {\n \n Server.prototype._limited = function(socket, message, messageType) {\n   var isLimited = false,\n-      rateLimiter = this._getRateLimiterForMessageType(messageType);\n+      rateLimiter = this._getRateLimiterForMessageType(messageType),\n+      softLimit;\n \n   if (message.op !== 'subscribe' && message.op !== 'sync') {\n     return false;\n   }\n-  \n-  if (rateLimiter && rateLimiter.isAboveLimit(socket.id)) {\n-    logging.warn('#socket.message - rate limited', message, socket.id);\n-    isLimited = true;\n+\n+  if (rateLimiter) {\n+    if (rateLimiter.isAboveLimit(socket.id)) {\n+      logging.warn('#socket.message - rate limited', message, socket.id);\n+      isLimited = true;\n+    }\n+\n+\n+    // Log Soft Limit, if available. \n+    if (messageType && messageType.policy && messageType.policy.softLimit) {\n+      softLimit = messageType.policy.softLimit;\n+      if (rateLimiter.isAboveLimit(socket.id, softLimit)) {\n+        this._logClientLimits(Client.get(socket.id), softLimit, rateLimiter.count(socket.id));\n+      }\n+    }\n   }\n \n   return isLimited;\n };\n \n+Server.prototype._logClientLimits = function(client, expected, actual) {\n+  logging.warn('#socket.message - rate soft limit reached', client.id, {","path":"server/server.js","position":36,"original_position":36,"commit_id":"8d124fe1e96c804a0a5764c855ed4ad7c9807703","original_commit_id":"8d124fe1e96c804a0a5764c855ed4ad7c9807703","user":{"login":"vanchi-zendesk","id":1341591,"avatar_url":"https://avatars.githubusercontent.com/u/1341591?v=3","gravatar_id":"","url":"https://api.github.com/users/vanchi-zendesk","html_url":"https://github.com/vanchi-zendesk","followers_url":"https://api.github.com/users/vanchi-zendesk/followers","following_url":"https://api.github.com/users/vanchi-zendesk/following{/other_user}","gists_url":"https://api.github.com/users/vanchi-zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/vanchi-zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanchi-zendesk/subscriptions","organizations_url":"https://api.github.com/users/vanchi-zendesk/orgs","repos_url":"https://api.github.com/users/vanchi-zendesk/repos","events_url":"https://api.github.com/users/vanchi-zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/vanchi-zendesk/received_events","type":"User","site_admin":false},"body":"(also log userID)","created_at":"2015-11-11T16:35:57Z","updated_at":"2015-11-11T16:35:57Z","html_url":"https://github.com/zendesk/radar/pull/188#discussion_r44553158","pull_request_url":"https://api.github.com/repos/zendesk/radar/pulls/188","_links":{"self":{"href":"https://api.github.com/repos/zendesk/radar/pulls/comments/44553158"},"html":{"href":"https://github.com/zendesk/radar/pull/188#discussion_r44553158"},"pull_request":{"href":"https://api.github.com/repos/zendesk/radar/pulls/188"}}},"pull_request":{"url":"https://api.github.com/repos/zendesk/radar/pulls/188","id":50350759,"html_url":"https://github.com/zendesk/radar/pull/188","diff_url":"https://github.com/zendesk/radar/pull/188.diff","patch_url":"https://github.com/zendesk/radar/pull/188.patch","issue_url":"https://api.github.com/repos/zendesk/radar/issues/188","number":188,"state":"open","locked":false,"title":"Enable logging of client state on softlimit","user":{"login":"lucasefe","id":2702,"avatar_url":"https://avatars.githubusercontent.com/u/2702?v=3","gravatar_id":"","url":"https://api.github.com/users/lucasefe","html_url":"https://github.com/lucasefe","followers_url":"https://api.github.com/users/lucasefe/followers","following_url":"https://api.github.com/users/lucasefe/following{/other_user}","gists_url":"https://api.github.com/users/lucasefe/gists{/gist_id}","starred_url":"https://api.github.com/users/lucasefe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucasefe/subscriptions","organizations_url":"https://api.github.com/users/lucasefe/orgs","repos_url":"https://api.github.com/users/lucasefe/repos","events_url":"https://api.github.com/users/lucasefe/events{/privacy}","received_events_url":"https://api.github.com/users/lucasefe/received_events","type":"User","site_admin":false},"body":"### Steps to merge\r\n - [ ] :+1: of the @zendesk/zendesk-radar team\r\n\r\n### Risks\r\n - None\r\n","created_at":"2015-11-11T05:55:03Z","updated_at":"2015-11-11T16:35:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"03595605c36e89787a0318ae663be7d5e5cbb77d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zendesk/radar/pulls/188/commits","review_comments_url":"https://api.github.com/repos/zendesk/radar/pulls/188/comments","review_comment_url":"https://api.github.com/repos/zendesk/radar/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zendesk/radar/issues/188/comments","statuses_url":"https://api.github.com/repos/zendesk/radar/statuses/8d124fe1e96c804a0a5764c855ed4ad7c9807703","head":{"label":"zendesk:lflorio/rate_limiter_soft_limit","ref":"lflorio/rate_limiter_soft_limit","sha":"8d124fe1e96c804a0a5764c855ed4ad7c9807703","user":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":6050800,"name":"radar","full_name":"zendesk/radar","owner":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/radar","description":"High level API and backend for writing web apps that use push messaging","fork":false,"url":"https://api.github.com/repos/zendesk/radar","forks_url":"https://api.github.com/repos/zendesk/radar/forks","keys_url":"https://api.github.com/repos/zendesk/radar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/radar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/radar/teams","hooks_url":"https://api.github.com/repos/zendesk/radar/hooks","issue_events_url":"https://api.github.com/repos/zendesk/radar/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/radar/events","assignees_url":"https://api.github.com/repos/zendesk/radar/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/radar/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/radar/tags","blobs_url":"https://api.github.com/repos/zendesk/radar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/radar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/radar/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/radar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/radar/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/radar/languages","stargazers_url":"https://api.github.com/repos/zendesk/radar/stargazers","contributors_url":"https://api.github.com/repos/zendesk/radar/contributors","subscribers_url":"https://api.github.com/repos/zendesk/radar/subscribers","subscription_url":"https://api.github.com/repos/zendesk/radar/subscription","commits_url":"https://api.github.com/repos/zendesk/radar/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/radar/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/radar/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/radar/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/radar/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/radar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/radar/merges","archive_url":"https://api.github.com/repos/zendesk/radar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/radar/downloads","issues_url":"https://api.github.com/repos/zendesk/radar/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/radar/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/radar/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/radar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/radar/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/radar/releases{/id}","created_at":"2012-10-02T20:15:07Z","updated_at":"2015-11-04T14:02:15Z","pushed_at":"2015-11-11T05:55:05Z","git_url":"git://github.com/zendesk/radar.git","ssh_url":"git@github.com:zendesk/radar.git","clone_url":"https://github.com/zendesk/radar.git","svn_url":"https://github.com/zendesk/radar","homepage":"http://radar.zendesk.com/","size":5676,"stargazers_count":165,"watchers_count":165,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":23,"mirror_url":null,"open_issues_count":10,"forks":23,"open_issues":10,"watchers":165,"default_branch":"master"}},"base":{"label":"zendesk:master","ref":"master","sha":"dd647f42b8818f7fd23a9bcffcac96681412628c","user":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":6050800,"name":"radar","full_name":"zendesk/radar","owner":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/radar","description":"High level API and backend for writing web apps that use push messaging","fork":false,"url":"https://api.github.com/repos/zendesk/radar","forks_url":"https://api.github.com/repos/zendesk/radar/forks","keys_url":"https://api.github.com/repos/zendesk/radar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/radar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/radar/teams","hooks_url":"https://api.github.com/repos/zendesk/radar/hooks","issue_events_url":"https://api.github.com/repos/zendesk/radar/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/radar/events","assignees_url":"https://api.github.com/repos/zendesk/radar/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/radar/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/radar/tags","blobs_url":"https://api.github.com/repos/zendesk/radar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/radar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/radar/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/radar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/radar/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/radar/languages","stargazers_url":"https://api.github.com/repos/zendesk/radar/stargazers","contributors_url":"https://api.github.com/repos/zendesk/radar/contributors","subscribers_url":"https://api.github.com/repos/zendesk/radar/subscribers","subscription_url":"https://api.github.com/repos/zendesk/radar/subscription","commits_url":"https://api.github.com/repos/zendesk/radar/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/radar/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/radar/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/radar/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/radar/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/radar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/radar/merges","archive_url":"https://api.github.com/repos/zendesk/radar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/radar/downloads","issues_url":"https://api.github.com/repos/zendesk/radar/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/radar/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/radar/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/radar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/radar/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/radar/releases{/id}","created_at":"2012-10-02T20:15:07Z","updated_at":"2015-11-04T14:02:15Z","pushed_at":"2015-11-11T05:55:05Z","git_url":"git://github.com/zendesk/radar.git","ssh_url":"git@github.com:zendesk/radar.git","clone_url":"https://github.com/zendesk/radar.git","svn_url":"https://github.com/zendesk/radar","homepage":"http://radar.zendesk.com/","size":5676,"stargazers_count":165,"watchers_count":165,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":23,"mirror_url":null,"open_issues_count":10,"forks":23,"open_issues":10,"watchers":165,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zendesk/radar/pulls/188"},"html":{"href":"https://github.com/zendesk/radar/pull/188"},"issue":{"href":"https://api.github.com/repos/zendesk/radar/issues/188"},"comments":{"href":"https://api.github.com/repos/zendesk/radar/issues/188/comments"},"review_comments":{"href":"https://api.github.com/repos/zendesk/radar/pulls/188/comments"},"review_comment":{"href":"https://api.github.com/repos/zendesk/radar/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zendesk/radar/pulls/188/commits"},"statuses":{"href":"https://api.github.com/repos/zendesk/radar/statuses/8d124fe1e96c804a0a5764c855ed4ad7c9807703"}}}}