{"action":"created","comment":{"url":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/comments/166268240","pull_request_review_id":94311701,"id":166268240,"diff_hunk":"@@ -49,10 +61,77 @@ public void should_fail_creating_app_insights_when_instrumentation_key_is_not_pr\n \n     @Test\n     public void should_create_app_insights_with_default_dev_mode_off() {\n-        context.setInstrumentationKey(\"some-key\");\n+        context.setInstrumentationKey(IKEY);\n \n         new AppInsights(telemetry);\n \n         assertThat(TelemetryConfiguration.getActive().getChannel().isDeveloperMode()).isFalse();\n     }\n+\n+    @Test\n+    public void should_track_message_acknowledgement_event_for_success_case() {\n+        context.setInstrumentationKey(IKEY);\n+\n+        AppInsights insights = new AppInsights(telemetry);\n+        Map<String, String> properties = Collections.singletonMap(\"messageId\", MESSAGE_ID);\n+        Duration timeTook = Duration.ofMinutes(1);\n+\n+        insights.trackMessageAcknowledgement(timeTook, true, MESSAGE_ID);\n+\n+        verify(telemetry).trackDependency(\n+            AppInsights.SERVICE_BUS_DEPENDENCY,\n+            AppInsights.SERVICE_BUS_MESSAGE_ACKNOWLEDGED,\n+            new com.microsoft.applicationinsights.telemetry.Duration(timeTook.toMillis()),\n+            true\n+        );\n+        verify(telemetry).trackEvent(AppInsights.SERVICE_BUS_MESSAGE_ACKNOWLEDGED, properties, null);\n+    }\n+\n+    @Test\n+    public void should_track_message_acknowledgement_event_for_fail_case() {\n+        context.setInstrumentationKey(IKEY);\n+\n+        AppInsights insights = new AppInsights(telemetry);\n+        Duration timeTook = Duration.ofMinutes(1);\n+\n+        insights.trackMessageAcknowledgement(timeTook, false, MESSAGE_ID);\n+\n+        verify(telemetry).trackDependency(\n+            AppInsights.SERVICE_BUS_DEPENDENCY,\n+            AppInsights.SERVICE_BUS_MESSAGE_ACKNOWLEDGED,\n+            new com.microsoft.applicationinsights.telemetry.Duration(timeTook.toMillis()),\n+            false\n+        );\n+    }","path":"src/test/java/uk/gov/hmcts/reform/sendletter/logging/AppInsightsTest.java","position":78,"original_position":78,"commit_id":"f757b93ad655c4eba01d00160babab897b185846","original_commit_id":"f757b93ad655c4eba01d00160babab897b185846","user":{"login":"nitinprabhu","id":13840402,"avatar_url":"https://avatars1.githubusercontent.com/u/13840402?v=4","gravatar_id":"","url":"https://api.github.com/users/nitinprabhu","html_url":"https://github.com/nitinprabhu","followers_url":"https://api.github.com/users/nitinprabhu/followers","following_url":"https://api.github.com/users/nitinprabhu/following{/other_user}","gists_url":"https://api.github.com/users/nitinprabhu/gists{/gist_id}","starred_url":"https://api.github.com/users/nitinprabhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nitinprabhu/subscriptions","organizations_url":"https://api.github.com/users/nitinprabhu/orgs","repos_url":"https://api.github.com/users/nitinprabhu/repos","events_url":"https://api.github.com/users/nitinprabhu/events{/privacy}","received_events_url":"https://api.github.com/users/nitinprabhu/received_events","type":"User","site_admin":false},"body":"It would be good if we add verifyNoMoreInteractions(telemetry);","created_at":"2018-02-06T11:34:21Z","updated_at":"2018-02-06T11:34:21Z","html_url":"https://github.com/hmcts/send-letter-producer-service/pull/43#discussion_r166268240","pull_request_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/43","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/comments/166268240"},"html":{"href":"https://github.com/hmcts/send-letter-producer-service/pull/43#discussion_r166268240"},"pull_request":{"href":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/43","id":166578796,"html_url":"https://github.com/hmcts/send-letter-producer-service/pull/43","diff_url":"https://github.com/hmcts/send-letter-producer-service/pull/43.diff","patch_url":"https://github.com/hmcts/send-letter-producer-service/pull/43.patch","issue_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/issues/43","number":43,"state":"open","locked":false,"title":"Insight metrics","user":{"login":"doncem","id":1420191,"avatar_url":"https://avatars3.githubusercontent.com/u/1420191?v=4","gravatar_id":"","url":"https://api.github.com/users/doncem","html_url":"https://github.com/doncem","followers_url":"https://api.github.com/users/doncem/followers","following_url":"https://api.github.com/users/doncem/following{/other_user}","gists_url":"https://api.github.com/users/doncem/gists{/gist_id}","starred_url":"https://api.github.com/users/doncem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doncem/subscriptions","organizations_url":"https://api.github.com/users/doncem/orgs","repos_url":"https://api.github.com/users/doncem/repos","events_url":"https://api.github.com/users/doncem/events{/privacy}","received_events_url":"https://api.github.com/users/doncem/received_events","type":"User","site_admin":false},"body":"### JIRA link (if applicable) ###\r\n\r\n[Metrics](https://tools.hmcts.net/jira/browse/RPE-210)\r\n\r\n### Change description ###\r\n\r\nTrack events of message receive and acknowledgement\r\n\r\n**Does this PR introduce a breaking change?** (check one with \"x\")\r\n\r\n```\r\n[ ] Yes\r\n[x] No\r\n```\r\n","created_at":"2018-02-01T16:03:18Z","updated_at":"2018-02-06T11:34:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dcfa29f666754816ed8183d843b2931b63e35ffa","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/43/commits","review_comments_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/43/comments","review_comment_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/issues/43/comments","statuses_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/statuses/f757b93ad655c4eba01d00160babab897b185846","head":{"label":"hmcts:RPE-210/insight-metrics","ref":"RPE-210/insight-metrics","sha":"f757b93ad655c4eba01d00160babab897b185846","user":{"login":"hmcts","id":22817111,"avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"repo":{"id":117090637,"name":"send-letter-producer-service","full_name":"hmcts/send-letter-producer-service","owner":{"login":"hmcts","id":22817111,"avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmcts/send-letter-producer-service","description":null,"fork":false,"url":"https://api.github.com/repos/hmcts/send-letter-producer-service","forks_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/forks","keys_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/teams","hooks_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/hooks","issue_events_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/issues/events{/number}","events_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/events","assignees_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/assignees{/user}","branches_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/branches{/branch}","tags_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/tags","blobs_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/statuses/{sha}","languages_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/languages","stargazers_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/stargazers","contributors_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/contributors","subscribers_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/subscribers","subscription_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/subscription","commits_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/contents/{+path}","compare_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/merges","archive_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/downloads","issues_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/issues{/number}","pulls_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls{/number}","milestones_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/milestones{/number}","notifications_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/labels{/name}","releases_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/releases{/id}","deployments_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/deployments","created_at":"2018-01-11T11:20:52Z","updated_at":"2018-01-23T16:20:39Z","pushed_at":"2018-02-06T10:51:58Z","git_url":"git://github.com/hmcts/send-letter-producer-service.git","ssh_url":"git@github.com:hmcts/send-letter-producer-service.git","clone_url":"https://github.com/hmcts/send-letter-producer-service.git","svn_url":"https://github.com/hmcts/send-letter-producer-service","homepage":null,"size":554,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"hmcts:master","ref":"master","sha":"c88c3aaada362fa0d4f1fa587a1e59aed93cc945","user":{"login":"hmcts","id":22817111,"avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"repo":{"id":117090637,"name":"send-letter-producer-service","full_name":"hmcts/send-letter-producer-service","owner":{"login":"hmcts","id":22817111,"avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmcts/send-letter-producer-service","description":null,"fork":false,"url":"https://api.github.com/repos/hmcts/send-letter-producer-service","forks_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/forks","keys_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/teams","hooks_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/hooks","issue_events_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/issues/events{/number}","events_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/events","assignees_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/assignees{/user}","branches_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/branches{/branch}","tags_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/tags","blobs_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/statuses/{sha}","languages_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/languages","stargazers_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/stargazers","contributors_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/contributors","subscribers_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/subscribers","subscription_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/subscription","commits_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/contents/{+path}","compare_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/merges","archive_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/downloads","issues_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/issues{/number}","pulls_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls{/number}","milestones_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/milestones{/number}","notifications_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/labels{/name}","releases_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/releases{/id}","deployments_url":"https://api.github.com/repos/hmcts/send-letter-producer-service/deployments","created_at":"2018-01-11T11:20:52Z","updated_at":"2018-01-23T16:20:39Z","pushed_at":"2018-02-06T10:51:58Z","git_url":"git://github.com/hmcts/send-letter-producer-service.git","ssh_url":"git@github.com:hmcts/send-letter-producer-service.git","clone_url":"https://github.com/hmcts/send-letter-producer-service.git","svn_url":"https://github.com/hmcts/send-letter-producer-service","homepage":null,"size":554,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/43"},"html":{"href":"https://github.com/hmcts/send-letter-producer-service/pull/43"},"issue":{"href":"https://api.github.com/repos/hmcts/send-letter-producer-service/issues/43"},"comments":{"href":"https://api.github.com/repos/hmcts/send-letter-producer-service/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hmcts/send-letter-producer-service/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/hmcts/send-letter-producer-service/statuses/f757b93ad655c4eba01d00160babab897b185846"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"nitinprabhu"}}