{"action":"closed","number":948,"pull_request":{"url":"https://api.github.com/repos/alphagov/notifications-api/pulls/948","id":120095793,"html_url":"https://github.com/alphagov/notifications-api/pull/948","diff_url":"https://github.com/alphagov/notifications-api/pull/948.diff","patch_url":"https://github.com/alphagov/notifications-api/pull/948.patch","issue_url":"https://api.github.com/repos/alphagov/notifications-api/issues/948","number":948,"state":"closed","locked":false,"title":"Async job stats","user":{"login":"minglis","id":369454,"avatar_url":"https://avatars2.githubusercontent.com/u/369454?v=3","gravatar_id":"","url":"https://api.github.com/users/minglis","html_url":"https://github.com/minglis","followers_url":"https://api.github.com/users/minglis/followers","following_url":"https://api.github.com/users/minglis/following{/other_user}","gists_url":"https://api.github.com/users/minglis/gists{/gist_id}","starred_url":"https://api.github.com/users/minglis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minglis/subscriptions","organizations_url":"https://api.github.com/users/minglis/orgs","repos_url":"https://api.github.com/users/minglis/repos","events_url":"https://api.github.com/users/minglis/events{/privacy}","received_events_url":"https://api.github.com/users/minglis/received_events","type":"User","site_admin":false},"body":"First pass at building offline, aggregate statistics.\r\n\r\nDoing jobs first as these are:\r\n(a) Source of lag on the service dashboard page\r\n(b) low impact as not used for billing etc\r\n\r\nTwo new tasks created to handle counting the job data. \r\n- record initial send\r\n- record outcome\r\n\r\nThese increment counters against the job for each notification type, three columns\r\n1) Sent (incremented when we send a message)\r\n2) Failed (incremented on a failed callback)\r\n3) Delivered (incremented on a success callback)\r\n\r\nThese DAO methods do a sort of hand rolled upsert:\r\n- attempt to update\r\n- if no rows updated attempt to insert\r\n- if insert fails due to constraint (ie row already exists) then try update again\r\n\r\nThe tasks are only created if the notification is in the correct state:\r\n- create initial task IF NOT IN COMPLETED STATE\r\n- create outcome task IF IN COMPLETED STATE\r\n\r\nAlso times out the job counts in the same way we do for notifications: bump the failed count to marry up sent with (delivered + failed) after the timeout window.\r\n\r\nThis story is missing 1 thing:\r\n1) Proper treatment of letter jobs (not sure what the states are and how they map)\r\n\r\n\r\n","created_at":"2017-05-11T12:38:15Z","updated_at":"2017-05-18T08:52:24Z","closed_at":"2017-05-18T08:52:24Z","merged_at":"2017-05-18T08:52:24Z","merge_commit_sha":"8e4466bc049be2b93ec19c07c6edeb7bcc40d80e","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/notifications-api/pulls/948/commits","review_comments_url":"https://api.github.com/repos/alphagov/notifications-api/pulls/948/comments","review_comment_url":"https://api.github.com/repos/alphagov/notifications-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/notifications-api/issues/948/comments","statuses_url":"https://api.github.com/repos/alphagov/notifications-api/statuses/8dc7a861485534d7dfd9f0bce1537950d5e10461","head":{"label":"alphagov:async-job-stats","ref":"async-job-stats","sha":"8dc7a861485534d7dfd9f0bce1537950d5e10461","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars3.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":46422101,"name":"notifications-api","full_name":"alphagov/notifications-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars3.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/notifications-api","description":"Notifications api","fork":false,"url":"https://api.github.com/repos/alphagov/notifications-api","forks_url":"https://api.github.com/repos/alphagov/notifications-api/forks","keys_url":"https://api.github.com/repos/alphagov/notifications-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/notifications-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/notifications-api/teams","hooks_url":"https://api.github.com/repos/alphagov/notifications-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/notifications-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/notifications-api/events","assignees_url":"https://api.github.com/repos/alphagov/notifications-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/notifications-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/notifications-api/tags","blobs_url":"https://api.github.com/repos/alphagov/notifications-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/notifications-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/notifications-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/notifications-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/notifications-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/notifications-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/notifications-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/notifications-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/notifications-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/notifications-api/subscription","commits_url":"https://api.github.com/repos/alphagov/notifications-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/notifications-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/notifications-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/notifications-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/notifications-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/notifications-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/notifications-api/merges","archive_url":"https://api.github.com/repos/alphagov/notifications-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/notifications-api/downloads","issues_url":"https://api.github.com/repos/alphagov/notifications-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/notifications-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/notifications-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/notifications-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/notifications-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/notifications-api/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/notifications-api/deployments","created_at":"2015-11-18T13:57:17Z","updated_at":"2017-05-17T11:27:05Z","pushed_at":"2017-05-18T08:52:24Z","git_url":"git://github.com/alphagov/notifications-api.git","ssh_url":"git@github.com:alphagov/notifications-api.git","clone_url":"https://github.com/alphagov/notifications-api.git","svn_url":"https://github.com/alphagov/notifications-api","homepage":null,"size":13370,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":4,"forks":2,"open_issues":4,"watchers":7,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"7850781245d1a0656cce7ec1c64cd02609a3b7de","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars3.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":46422101,"name":"notifications-api","full_name":"alphagov/notifications-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars3.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/notifications-api","description":"Notifications api","fork":false,"url":"https://api.github.com/repos/alphagov/notifications-api","forks_url":"https://api.github.com/repos/alphagov/notifications-api/forks","keys_url":"https://api.github.com/repos/alphagov/notifications-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/notifications-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/notifications-api/teams","hooks_url":"https://api.github.com/repos/alphagov/notifications-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/notifications-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/notifications-api/events","assignees_url":"https://api.github.com/repos/alphagov/notifications-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/notifications-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/notifications-api/tags","blobs_url":"https://api.github.com/repos/alphagov/notifications-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/notifications-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/notifications-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/notifications-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/notifications-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/notifications-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/notifications-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/notifications-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/notifications-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/notifications-api/subscription","commits_url":"https://api.github.com/repos/alphagov/notifications-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/notifications-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/notifications-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/notifications-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/notifications-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/notifications-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/notifications-api/merges","archive_url":"https://api.github.com/repos/alphagov/notifications-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/notifications-api/downloads","issues_url":"https://api.github.com/repos/alphagov/notifications-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/notifications-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/notifications-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/notifications-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/notifications-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/notifications-api/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/notifications-api/deployments","created_at":"2015-11-18T13:57:17Z","updated_at":"2017-05-17T11:27:05Z","pushed_at":"2017-05-18T08:52:24Z","git_url":"git://github.com/alphagov/notifications-api.git","ssh_url":"git@github.com:alphagov/notifications-api.git","clone_url":"https://github.com/alphagov/notifications-api.git","svn_url":"https://github.com/alphagov/notifications-api","homepage":null,"size":13370,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":4,"forks":2,"open_issues":4,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/notifications-api/pulls/948"},"html":{"href":"https://github.com/alphagov/notifications-api/pull/948"},"issue":{"href":"https://api.github.com/repos/alphagov/notifications-api/issues/948"},"comments":{"href":"https://api.github.com/repos/alphagov/notifications-api/issues/948/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/notifications-api/pulls/948/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/notifications-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/notifications-api/pulls/948/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/notifications-api/statuses/8dc7a861485534d7dfd9f0bce1537950d5e10461"}},"merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"minglis","id":369454,"avatar_url":"https://avatars2.githubusercontent.com/u/369454?v=3","gravatar_id":"","url":"https://api.github.com/users/minglis","html_url":"https://github.com/minglis","followers_url":"https://api.github.com/users/minglis/followers","following_url":"https://api.github.com/users/minglis/following{/other_user}","gists_url":"https://api.github.com/users/minglis/gists{/gist_id}","starred_url":"https://api.github.com/users/minglis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minglis/subscriptions","organizations_url":"https://api.github.com/users/minglis/orgs","repos_url":"https://api.github.com/users/minglis/repos","events_url":"https://api.github.com/users/minglis/events{/privacy}","received_events_url":"https://api.github.com/users/minglis/received_events","type":"User","site_admin":false},"comments":0,"review_comments":18,"maintainer_can_modify":false,"commits":36,"additions":1541,"deletions":48,"changed_files":19}}
{"actor":{"display_login":"minglis"}}