{"action":"created","comment":{"url":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/comments/117213591","pull_request_review_id":38899465,"id":117213591,"diff_hunk":"@@ -53,25 +56,30 @@ object ClientRelationship {\n class DesConnector @Inject()(@Named(\"des-baseUrl\") baseUrl: URL,\n                              @Named(\"des.authorizationToken\") authorizationToken: String,\n                              @Named(\"des.environment\") environment: String,\n-                             httpGet: HttpGet) {\n+                             httpGet: HttpGet,\n+                             metrics: Metrics)\n+  extends HttpAPIMonitor {\n+  override val kenshooRegistry: MetricRegistry = metrics.defaultRegistry\n \n   def getNinoFor(mtdbsa: MtdItId)(implicit hc: HeaderCarrier): Future[Nino] = {\n     val url = new URL(baseUrl, s\"/registration/business-details/mtdbsa/${ encodePathSegment(mtdbsa.value) }\")\n-    getWithDesHeaders[BusinessDetails](url).map(_.nino)\n+    getWithDesHeaders[BusinessDetails](\"GetRegistrationBusinessDetailsByMtdbsa\", url).map(_.nino)\n   }\n \n   def getClientSaAgentSaReferences(nino: Nino)(implicit hc: HeaderCarrier): Future[Seq[SaAgentReference]] = {\n     val url = new URL(baseUrl, s\"/registration/relationship/nino/${ encodePathSegment(nino.value) }\")\n-    getWithDesHeaders[ClientRelationship](url).map(_.agents.flatMap {\n+    getWithDesHeaders[ClientRelationship](\"GetStatusAgentRelationship\", url).map(_.agents.flatMap {\n       case Agent(true, Some(agentId), None) => Some(agentId)\n       case _ => None\n     })\n   }\n \n-  private def getWithDesHeaders[A: HttpReads](url: URL)(implicit hc: HeaderCarrier): Future[A] = {\n+  private def getWithDesHeaders[A: HttpReads](apiName: String, url: URL)(implicit hc: HeaderCarrier): Future[A] = {\n     val desHeaderCarrier = hc.copy(\n       authorization = Some(Authorization(s\"Bearer $authorizationToken\")),\n       extraHeaders = hc.extraHeaders :+ \"Environment\" -> environment)\n-    httpGet.GET[A](url.toString)(implicitly[HttpReads[A]], desHeaderCarrier)\n+    monitor(s\"ConsumedAPI-DES-$apiName-GET\") {","path":"app/uk/gov/hmrc/agentclientrelationships/connectors/DesConnector.scala","position":44,"original_position":44,"commit_id":"e7cf6e8c36cbfcfc48d00e99c632b97f8eb5b3b3","original_commit_id":"e7cf6e8c36cbfcfc48d00e99c632b97f8eb5b3b3","user":{"login":"frankoid","id":414981,"avatar_url":"https://avatars1.githubusercontent.com/u/414981?v=3","gravatar_id":"","url":"https://api.github.com/users/frankoid","html_url":"https://github.com/frankoid","followers_url":"https://api.github.com/users/frankoid/followers","following_url":"https://api.github.com/users/frankoid/following{/other_user}","gists_url":"https://api.github.com/users/frankoid/gists{/gist_id}","starred_url":"https://api.github.com/users/frankoid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frankoid/subscriptions","organizations_url":"https://api.github.com/users/frankoid/orgs","repos_url":"https://api.github.com/users/frankoid/repos","events_url":"https://api.github.com/users/frankoid/events{/privacy}","received_events_url":"https://api.github.com/users/frankoid/received_events","type":"User","site_admin":false},"body":"I can't find a test for this (and it would be good to have one) - I think examples of testing this kind of monitoring can be found in some of our other services.","created_at":"2017-05-18T10:31:24Z","updated_at":"2017-05-18T10:31:24Z","html_url":"https://github.com/hmrc/agent-client-relationships/pull/11#discussion_r117213591","pull_request_url":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/comments/117213591"},"html":{"href":"https://github.com/hmrc/agent-client-relationships/pull/11#discussion_r117213591"},"pull_request":{"href":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/11","id":121244417,"html_url":"https://github.com/hmrc/agent-client-relationships/pull/11","diff_url":"https://github.com/hmrc/agent-client-relationships/pull/11.diff","patch_url":"https://github.com/hmrc/agent-client-relationships/pull/11.patch","issue_url":"https://api.github.com/repos/hmrc/agent-client-relationships/issues/11","number":11,"state":"open","locked":false,"title":"[AO][APB-792] monitor outgoing des and mapping calls","user":{"login":"arturopala","id":250927,"avatar_url":"https://avatars2.githubusercontent.com/u/250927?v=3","gravatar_id":"","url":"https://api.github.com/users/arturopala","html_url":"https://github.com/arturopala","followers_url":"https://api.github.com/users/arturopala/followers","following_url":"https://api.github.com/users/arturopala/following{/other_user}","gists_url":"https://api.github.com/users/arturopala/gists{/gist_id}","starred_url":"https://api.github.com/users/arturopala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arturopala/subscriptions","organizations_url":"https://api.github.com/users/arturopala/orgs","repos_url":"https://api.github.com/users/arturopala/repos","events_url":"https://api.github.com/users/arturopala/events{/privacy}","received_events_url":"https://api.github.com/users/arturopala/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-05-18T09:58:24Z","updated_at":"2017-05-18T10:31:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d07d23694ae461b797e12c71b3c69cd45249d1be","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/11/commits","review_comments_url":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/11/comments","review_comment_url":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hmrc/agent-client-relationships/issues/11/comments","statuses_url":"https://api.github.com/repos/hmrc/agent-client-relationships/statuses/e7cf6e8c36cbfcfc48d00e99c632b97f8eb5b3b3","head":{"label":"hmrc:APB-792-monitoring","ref":"APB-792-monitoring","sha":"e7cf6e8c36cbfcfc48d00e99c632b97f8eb5b3b3","user":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars2.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"repo":{"id":68680193,"name":"agent-client-relationships","full_name":"hmrc/agent-client-relationships","owner":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars2.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmrc/agent-client-relationships","description":null,"fork":false,"url":"https://api.github.com/repos/hmrc/agent-client-relationships","forks_url":"https://api.github.com/repos/hmrc/agent-client-relationships/forks","keys_url":"https://api.github.com/repos/hmrc/agent-client-relationships/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/agent-client-relationships/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/agent-client-relationships/teams","hooks_url":"https://api.github.com/repos/hmrc/agent-client-relationships/hooks","issue_events_url":"https://api.github.com/repos/hmrc/agent-client-relationships/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/agent-client-relationships/events","assignees_url":"https://api.github.com/repos/hmrc/agent-client-relationships/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/agent-client-relationships/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/agent-client-relationships/tags","blobs_url":"https://api.github.com/repos/hmrc/agent-client-relationships/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/agent-client-relationships/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/agent-client-relationships/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/agent-client-relationships/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/agent-client-relationships/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/agent-client-relationships/languages","stargazers_url":"https://api.github.com/repos/hmrc/agent-client-relationships/stargazers","contributors_url":"https://api.github.com/repos/hmrc/agent-client-relationships/contributors","subscribers_url":"https://api.github.com/repos/hmrc/agent-client-relationships/subscribers","subscription_url":"https://api.github.com/repos/hmrc/agent-client-relationships/subscription","commits_url":"https://api.github.com/repos/hmrc/agent-client-relationships/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/agent-client-relationships/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/agent-client-relationships/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/agent-client-relationships/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/agent-client-relationships/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/agent-client-relationships/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/agent-client-relationships/merges","archive_url":"https://api.github.com/repos/hmrc/agent-client-relationships/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/agent-client-relationships/downloads","issues_url":"https://api.github.com/repos/hmrc/agent-client-relationships/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/agent-client-relationships/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/agent-client-relationships/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/agent-client-relationships/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/agent-client-relationships/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/agent-client-relationships/deployments","created_at":"2016-09-20T06:15:31Z","updated_at":"2016-09-20T06:22:09Z","pushed_at":"2017-05-18T09:58:24Z","git_url":"git://github.com/hmrc/agent-client-relationships.git","ssh_url":"git@github.com:hmrc/agent-client-relationships.git","clone_url":"https://github.com/hmrc/agent-client-relationships.git","svn_url":"https://github.com/hmrc/agent-client-relationships","homepage":"","size":104,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"hmrc:master","ref":"master","sha":"567f8ed78c1d33395b6c1799b3d8a0868abab6d4","user":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars2.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"repo":{"id":68680193,"name":"agent-client-relationships","full_name":"hmrc/agent-client-relationships","owner":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars2.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmrc/agent-client-relationships","description":null,"fork":false,"url":"https://api.github.com/repos/hmrc/agent-client-relationships","forks_url":"https://api.github.com/repos/hmrc/agent-client-relationships/forks","keys_url":"https://api.github.com/repos/hmrc/agent-client-relationships/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/agent-client-relationships/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/agent-client-relationships/teams","hooks_url":"https://api.github.com/repos/hmrc/agent-client-relationships/hooks","issue_events_url":"https://api.github.com/repos/hmrc/agent-client-relationships/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/agent-client-relationships/events","assignees_url":"https://api.github.com/repos/hmrc/agent-client-relationships/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/agent-client-relationships/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/agent-client-relationships/tags","blobs_url":"https://api.github.com/repos/hmrc/agent-client-relationships/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/agent-client-relationships/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/agent-client-relationships/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/agent-client-relationships/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/agent-client-relationships/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/agent-client-relationships/languages","stargazers_url":"https://api.github.com/repos/hmrc/agent-client-relationships/stargazers","contributors_url":"https://api.github.com/repos/hmrc/agent-client-relationships/contributors","subscribers_url":"https://api.github.com/repos/hmrc/agent-client-relationships/subscribers","subscription_url":"https://api.github.com/repos/hmrc/agent-client-relationships/subscription","commits_url":"https://api.github.com/repos/hmrc/agent-client-relationships/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/agent-client-relationships/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/agent-client-relationships/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/agent-client-relationships/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/agent-client-relationships/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/agent-client-relationships/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/agent-client-relationships/merges","archive_url":"https://api.github.com/repos/hmrc/agent-client-relationships/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/agent-client-relationships/downloads","issues_url":"https://api.github.com/repos/hmrc/agent-client-relationships/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/agent-client-relationships/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/agent-client-relationships/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/agent-client-relationships/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/agent-client-relationships/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/agent-client-relationships/deployments","created_at":"2016-09-20T06:15:31Z","updated_at":"2016-09-20T06:22:09Z","pushed_at":"2017-05-18T09:58:24Z","git_url":"git://github.com/hmrc/agent-client-relationships.git","ssh_url":"git@github.com:hmrc/agent-client-relationships.git","clone_url":"https://github.com/hmrc/agent-client-relationships.git","svn_url":"https://github.com/hmrc/agent-client-relationships","homepage":"","size":104,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/11"},"html":{"href":"https://github.com/hmrc/agent-client-relationships/pull/11"},"issue":{"href":"https://api.github.com/repos/hmrc/agent-client-relationships/issues/11"},"comments":{"href":"https://api.github.com/repos/hmrc/agent-client-relationships/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hmrc/agent-client-relationships/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/hmrc/agent-client-relationships/statuses/e7cf6e8c36cbfcfc48d00e99c632b97f8eb5b3b3"}}}}
{"actor":{"display_login":"frankoid"}}