{"action":"created","comment":{"url":"https://api.github.com/repos/linkedin/iris/pulls/comments/142825079","pull_request_review_id":67243756,"id":142825079,"diff_hunk":"@@ -3670,6 +3675,18 @@ def on_get(self, req, resp, app_name):\n             stats['pct_%s_fail_last_month' % mode] = fail_pct\n             stats['pct_%s_other_last_month' % mode] = other_pct\n \n+        for mode in cache.modes:\n+            cursor.execute('''SELECT COUNT(*) FROM `message`\n+                              WHERE `sent` > (CURRENT_DATE - INTERVAL 29 DAY)\n+                              AND `sent` < (CURRENT_DATE - INTERVAL 1 DAY)\n+                              AND `application_id` = %(application_id)s\n+                              AND `mode_id` = (SELECT `id` FROM `mode` WHERE `name` = %(mode)s)''',\n+                           {'application_id': app['id'], 'mode': mode})\n+            num_sent = cursor.fetchone()\n+            if num_sent is not None:\n+                num_sent = num_sent[-1]","path":"src/iris/api.py","position":25,"original_position":25,"commit_id":"fa4e313018b6189e09592f68d547d8f1bf9801c0","original_commit_id":"fa4e313018b6189e09592f68d547d8f1bf9801c0","user":{"login":"dwang159","id":4897515,"avatar_url":"https://avatars1.githubusercontent.com/u/4897515?v=4","gravatar_id":"","url":"https://api.github.com/users/dwang159","html_url":"https://github.com/dwang159","followers_url":"https://api.github.com/users/dwang159/followers","following_url":"https://api.github.com/users/dwang159/following{/other_user}","gists_url":"https://api.github.com/users/dwang159/gists{/gist_id}","starred_url":"https://api.github.com/users/dwang159/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwang159/subscriptions","organizations_url":"https://api.github.com/users/dwang159/orgs","repos_url":"https://api.github.com/users/dwang159/repos","events_url":"https://api.github.com/users/dwang159/events{/privacy}","received_events_url":"https://api.github.com/users/dwang159/received_events","type":"User","site_admin":false},"body":"1. -1 is consistent with the earlier stats query, but also it looks like it does that specifically for the median_seconds_to_claim to work. 0 it is.\r\n2. Count(*) should always return 1 row, so I'm not sure if None ever happens. Even if it does happen, I think None would be better than 0, since 0 implies no messages were sent and None implies something crazy happened.","created_at":"2017-10-05T00:20:33Z","updated_at":"2017-10-05T00:20:33Z","html_url":"https://github.com/linkedin/iris/pull/276#discussion_r142825079","pull_request_url":"https://api.github.com/repos/linkedin/iris/pulls/276","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/linkedin/iris/pulls/comments/142825079"},"html":{"href":"https://github.com/linkedin/iris/pull/276#discussion_r142825079"},"pull_request":{"href":"https://api.github.com/repos/linkedin/iris/pulls/276"}},"in_reply_to_id":142819373},"pull_request":{"url":"https://api.github.com/repos/linkedin/iris/pulls/276","id":144795867,"html_url":"https://github.com/linkedin/iris/pull/276","diff_url":"https://github.com/linkedin/iris/pull/276.diff","patch_url":"https://github.com/linkedin/iris/pull/276.patch","issue_url":"https://api.github.com/repos/linkedin/iris/issues/276","number":276,"state":"open","locked":false,"title":"Add stats per application","user":{"login":"dwang159","id":4897515,"avatar_url":"https://avatars1.githubusercontent.com/u/4897515?v=4","gravatar_id":"","url":"https://api.github.com/users/dwang159","html_url":"https://github.com/dwang159","followers_url":"https://api.github.com/users/dwang159/followers","following_url":"https://api.github.com/users/dwang159/following{/other_user}","gists_url":"https://api.github.com/users/dwang159/gists{/gist_id}","starred_url":"https://api.github.com/users/dwang159/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwang159/subscriptions","organizations_url":"https://api.github.com/users/dwang159/orgs","repos_url":"https://api.github.com/users/dwang159/repos","events_url":"https://api.github.com/users/dwang159/events{/privacy}","received_events_url":"https://api.github.com/users/dwang159/received_events","type":"User","site_admin":false},"body":"Get message counts per app, per mode. Also get call retry count","created_at":"2017-10-04T23:00:55Z","updated_at":"2017-10-05T00:20:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c51b17c7116a9ea09315341fa1687ed9c8331d85","assignee":null,"assignees":[],"requested_reviewers":[{"login":"fellyns","id":10618692,"avatar_url":"https://avatars0.githubusercontent.com/u/10618692?v=4","gravatar_id":"","url":"https://api.github.com/users/fellyns","html_url":"https://github.com/fellyns","followers_url":"https://api.github.com/users/fellyns/followers","following_url":"https://api.github.com/users/fellyns/following{/other_user}","gists_url":"https://api.github.com/users/fellyns/gists{/gist_id}","starred_url":"https://api.github.com/users/fellyns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fellyns/subscriptions","organizations_url":"https://api.github.com/users/fellyns/orgs","repos_url":"https://api.github.com/users/fellyns/repos","events_url":"https://api.github.com/users/fellyns/events{/privacy}","received_events_url":"https://api.github.com/users/fellyns/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/linkedin/iris/pulls/276/commits","review_comments_url":"https://api.github.com/repos/linkedin/iris/pulls/276/comments","review_comment_url":"https://api.github.com/repos/linkedin/iris/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linkedin/iris/issues/276/comments","statuses_url":"https://api.github.com/repos/linkedin/iris/statuses/fa4e313018b6189e09592f68d547d8f1bf9801c0","head":{"label":"dwang159:stats","ref":"stats","sha":"fa4e313018b6189e09592f68d547d8f1bf9801c0","user":{"login":"dwang159","id":4897515,"avatar_url":"https://avatars1.githubusercontent.com/u/4897515?v=4","gravatar_id":"","url":"https://api.github.com/users/dwang159","html_url":"https://github.com/dwang159","followers_url":"https://api.github.com/users/dwang159/followers","following_url":"https://api.github.com/users/dwang159/following{/other_user}","gists_url":"https://api.github.com/users/dwang159/gists{/gist_id}","starred_url":"https://api.github.com/users/dwang159/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwang159/subscriptions","organizations_url":"https://api.github.com/users/dwang159/orgs","repos_url":"https://api.github.com/users/dwang159/repos","events_url":"https://api.github.com/users/dwang159/events{/privacy}","received_events_url":"https://api.github.com/users/dwang159/received_events","type":"User","site_admin":false},"repo":{"id":87488835,"name":"iris-api","full_name":"dwang159/iris-api","owner":{"login":"dwang159","id":4897515,"avatar_url":"https://avatars1.githubusercontent.com/u/4897515?v=4","gravatar_id":"","url":"https://api.github.com/users/dwang159","html_url":"https://github.com/dwang159","followers_url":"https://api.github.com/users/dwang159/followers","following_url":"https://api.github.com/users/dwang159/following{/other_user}","gists_url":"https://api.github.com/users/dwang159/gists{/gist_id}","starred_url":"https://api.github.com/users/dwang159/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwang159/subscriptions","organizations_url":"https://api.github.com/users/dwang159/orgs","repos_url":"https://api.github.com/users/dwang159/repos","events_url":"https://api.github.com/users/dwang159/events{/privacy}","received_events_url":"https://api.github.com/users/dwang159/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dwang159/iris-api","description":"Iris API core and sender service.","fork":true,"url":"https://api.github.com/repos/dwang159/iris-api","forks_url":"https://api.github.com/repos/dwang159/iris-api/forks","keys_url":"https://api.github.com/repos/dwang159/iris-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dwang159/iris-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dwang159/iris-api/teams","hooks_url":"https://api.github.com/repos/dwang159/iris-api/hooks","issue_events_url":"https://api.github.com/repos/dwang159/iris-api/issues/events{/number}","events_url":"https://api.github.com/repos/dwang159/iris-api/events","assignees_url":"https://api.github.com/repos/dwang159/iris-api/assignees{/user}","branches_url":"https://api.github.com/repos/dwang159/iris-api/branches{/branch}","tags_url":"https://api.github.com/repos/dwang159/iris-api/tags","blobs_url":"https://api.github.com/repos/dwang159/iris-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dwang159/iris-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dwang159/iris-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/dwang159/iris-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dwang159/iris-api/statuses/{sha}","languages_url":"https://api.github.com/repos/dwang159/iris-api/languages","stargazers_url":"https://api.github.com/repos/dwang159/iris-api/stargazers","contributors_url":"https://api.github.com/repos/dwang159/iris-api/contributors","subscribers_url":"https://api.github.com/repos/dwang159/iris-api/subscribers","subscription_url":"https://api.github.com/repos/dwang159/iris-api/subscription","commits_url":"https://api.github.com/repos/dwang159/iris-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/dwang159/iris-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/dwang159/iris-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/dwang159/iris-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/dwang159/iris-api/contents/{+path}","compare_url":"https://api.github.com/repos/dwang159/iris-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dwang159/iris-api/merges","archive_url":"https://api.github.com/repos/dwang159/iris-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dwang159/iris-api/downloads","issues_url":"https://api.github.com/repos/dwang159/iris-api/issues{/number}","pulls_url":"https://api.github.com/repos/dwang159/iris-api/pulls{/number}","milestones_url":"https://api.github.com/repos/dwang159/iris-api/milestones{/number}","notifications_url":"https://api.github.com/repos/dwang159/iris-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dwang159/iris-api/labels{/name}","releases_url":"https://api.github.com/repos/dwang159/iris-api/releases{/id}","deployments_url":"https://api.github.com/repos/dwang159/iris-api/deployments","created_at":"2017-04-07T00:52:03Z","updated_at":"2017-04-07T00:52:04Z","pushed_at":"2017-10-04T22:59:15Z","git_url":"git://github.com/dwang159/iris-api.git","ssh_url":"git@github.com:dwang159/iris-api.git","clone_url":"https://github.com/dwang159/iris-api.git","svn_url":"https://github.com/dwang159/iris-api","homepage":null,"size":2006,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"linkedin:master","ref":"master","sha":"73c9a68b82fa34b0f3c8ff7c3ad3cbafb9c5b980","user":{"login":"linkedin","id":357098,"avatar_url":"https://avatars3.githubusercontent.com/u/357098?v=4","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"repo":{"id":79385525,"name":"iris","full_name":"linkedin/iris","owner":{"login":"linkedin","id":357098,"avatar_url":"https://avatars3.githubusercontent.com/u/357098?v=4","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linkedin/iris","description":"Iris is a highly configurable and flexible service for paging and messaging.","fork":false,"url":"https://api.github.com/repos/linkedin/iris","forks_url":"https://api.github.com/repos/linkedin/iris/forks","keys_url":"https://api.github.com/repos/linkedin/iris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linkedin/iris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linkedin/iris/teams","hooks_url":"https://api.github.com/repos/linkedin/iris/hooks","issue_events_url":"https://api.github.com/repos/linkedin/iris/issues/events{/number}","events_url":"https://api.github.com/repos/linkedin/iris/events","assignees_url":"https://api.github.com/repos/linkedin/iris/assignees{/user}","branches_url":"https://api.github.com/repos/linkedin/iris/branches{/branch}","tags_url":"https://api.github.com/repos/linkedin/iris/tags","blobs_url":"https://api.github.com/repos/linkedin/iris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linkedin/iris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linkedin/iris/git/refs{/sha}","trees_url":"https://api.github.com/repos/linkedin/iris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linkedin/iris/statuses/{sha}","languages_url":"https://api.github.com/repos/linkedin/iris/languages","stargazers_url":"https://api.github.com/repos/linkedin/iris/stargazers","contributors_url":"https://api.github.com/repos/linkedin/iris/contributors","subscribers_url":"https://api.github.com/repos/linkedin/iris/subscribers","subscription_url":"https://api.github.com/repos/linkedin/iris/subscription","commits_url":"https://api.github.com/repos/linkedin/iris/commits{/sha}","git_commits_url":"https://api.github.com/repos/linkedin/iris/git/commits{/sha}","comments_url":"https://api.github.com/repos/linkedin/iris/comments{/number}","issue_comment_url":"https://api.github.com/repos/linkedin/iris/issues/comments{/number}","contents_url":"https://api.github.com/repos/linkedin/iris/contents/{+path}","compare_url":"https://api.github.com/repos/linkedin/iris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linkedin/iris/merges","archive_url":"https://api.github.com/repos/linkedin/iris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linkedin/iris/downloads","issues_url":"https://api.github.com/repos/linkedin/iris/issues{/number}","pulls_url":"https://api.github.com/repos/linkedin/iris/pulls{/number}","milestones_url":"https://api.github.com/repos/linkedin/iris/milestones{/number}","notifications_url":"https://api.github.com/repos/linkedin/iris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linkedin/iris/labels{/name}","releases_url":"https://api.github.com/repos/linkedin/iris/releases{/id}","deployments_url":"https://api.github.com/repos/linkedin/iris/deployments","created_at":"2017-01-18T21:20:21Z","updated_at":"2017-09-26T10:49:41Z","pushed_at":"2017-10-04T23:00:56Z","git_url":"git://github.com/linkedin/iris.git","ssh_url":"git@github.com:linkedin/iris.git","clone_url":"https://github.com/linkedin/iris.git","svn_url":"https://github.com/linkedin/iris","homepage":"https://iris.claims","size":3603,"stargazers_count":191,"watchers_count":191,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":27,"mirror_url":null,"open_issues_count":12,"forks":27,"open_issues":12,"watchers":191,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/linkedin/iris/pulls/276"},"html":{"href":"https://github.com/linkedin/iris/pull/276"},"issue":{"href":"https://api.github.com/repos/linkedin/iris/issues/276"},"comments":{"href":"https://api.github.com/repos/linkedin/iris/issues/276/comments"},"review_comments":{"href":"https://api.github.com/repos/linkedin/iris/pulls/276/comments"},"review_comment":{"href":"https://api.github.com/repos/linkedin/iris/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linkedin/iris/pulls/276/commits"},"statuses":{"href":"https://api.github.com/repos/linkedin/iris/statuses/fa4e313018b6189e09592f68d547d8f1bf9801c0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dwang159"}}