{"action":"created","comment":{"url":"https://api.github.com/repos/telegraph/tmg-utils/pulls/comments/184938578","pull_request_review_id":116228931,"id":184938578,"diff_hunk":"@@ -0,0 +1,78 @@\n+package uk.co.telegraph.utils.server.metrics\n+\n+import akka.actor.ActorSystem\n+import com.codahale.metrics.{MetricRegistry, Timer}\n+import play.api.mvc.Result\n+\n+import scala.concurrent.ExecutionContext.Implicits.global\n+import scala.concurrent.Future\n+\n+trait MetricsDecorators {\n+\n+  val metricRegistry: MetricRegistry\n+  val system:ActorSystem\n+\n+  def countedAndTimed(metricName: String)(action: => Future[Result]): Future[Result] = {\n+    counted(metricName) {\n+      timed(metricName) {\n+        action\n+      }\n+    }\n+  }\n+\n+  def counted(counterName: String)(res: Future[Result]): Future[Result] = {\n+    res.map((result: Result) => {\n+      val statusCode = result.header.status\n+      statusCode match {\n+        case x if x >= 200 && x < 300 => metricRegistry.counter(s\"$counterName.success\").inc()","path":"play-server-ext/src/main/scala/uk/co/telegraph/utils/server/metrics/MetricsDecorators.scala","position":27,"original_position":27,"commit_id":"57337834216adb95778e1ccf115d11eb4f57c062","original_commit_id":"57337834216adb95778e1ccf115d11eb4f57c062","user":{"login":"iRhysBradbury","id":15735720,"avatar_url":"https://avatars0.githubusercontent.com/u/15735720?v=4","gravatar_id":"","url":"https://api.github.com/users/iRhysBradbury","html_url":"https://github.com/iRhysBradbury","followers_url":"https://api.github.com/users/iRhysBradbury/followers","following_url":"https://api.github.com/users/iRhysBradbury/following{/other_user}","gists_url":"https://api.github.com/users/iRhysBradbury/gists{/gist_id}","starred_url":"https://api.github.com/users/iRhysBradbury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iRhysBradbury/subscriptions","organizations_url":"https://api.github.com/users/iRhysBradbury/orgs","repos_url":"https://api.github.com/users/iRhysBradbury/repos","events_url":"https://api.github.com/users/iRhysBradbury/events{/privacy}","received_events_url":"https://api.github.com/users/iRhysBradbury/received_events","type":"User","site_admin":false},"body":"300 is a success here?","created_at":"2018-04-30T09:03:10Z","updated_at":"2018-04-30T09:03:10Z","html_url":"https://github.com/telegraph/tmg-utils/pull/9#discussion_r184938578","pull_request_url":"https://api.github.com/repos/telegraph/tmg-utils/pulls/9","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/telegraph/tmg-utils/pulls/comments/184938578"},"html":{"href":"https://github.com/telegraph/tmg-utils/pull/9#discussion_r184938578"},"pull_request":{"href":"https://api.github.com/repos/telegraph/tmg-utils/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/telegraph/tmg-utils/pulls/9","id":184765608,"html_url":"https://github.com/telegraph/tmg-utils/pull/9","diff_url":"https://github.com/telegraph/tmg-utils/pull/9.diff","patch_url":"https://github.com/telegraph/tmg-utils/pull/9.patch","issue_url":"https://api.github.com/repos/telegraph/tmg-utils/issues/9","number":9,"state":"open","locked":false,"title":"Ttt 2376 Added FutureErrorLogs, SimpleHttpClient, metrics related classes","user":{"login":"adicontiu","id":19661812,"avatar_url":"https://avatars3.githubusercontent.com/u/19661812?v=4","gravatar_id":"","url":"https://api.github.com/users/adicontiu","html_url":"https://github.com/adicontiu","followers_url":"https://api.github.com/users/adicontiu/followers","following_url":"https://api.github.com/users/adicontiu/following{/other_user}","gists_url":"https://api.github.com/users/adicontiu/gists{/gist_id}","starred_url":"https://api.github.com/users/adicontiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adicontiu/subscriptions","organizations_url":"https://api.github.com/users/adicontiu/orgs","repos_url":"https://api.github.com/users/adicontiu/repos","events_url":"https://api.github.com/users/adicontiu/events{/privacy}","received_events_url":"https://api.github.com/users/adicontiu/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-28T05:37:50Z","updated_at":"2018-04-30T09:03:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b61f85661c46ad2d6ed9798ab89c86ebea246ea","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/telegraph/tmg-utils/pulls/9/commits","review_comments_url":"https://api.github.com/repos/telegraph/tmg-utils/pulls/9/comments","review_comment_url":"https://api.github.com/repos/telegraph/tmg-utils/pulls/comments{/number}","comments_url":"https://api.github.com/repos/telegraph/tmg-utils/issues/9/comments","statuses_url":"https://api.github.com/repos/telegraph/tmg-utils/statuses/57337834216adb95778e1ccf115d11eb4f57c062","head":{"label":"telegraph:TTT-2376","ref":"TTT-2376","sha":"57337834216adb95778e1ccf115d11eb4f57c062","user":{"login":"telegraph","id":221228,"avatar_url":"https://avatars1.githubusercontent.com/u/221228?v=4","gravatar_id":"","url":"https://api.github.com/users/telegraph","html_url":"https://github.com/telegraph","followers_url":"https://api.github.com/users/telegraph/followers","following_url":"https://api.github.com/users/telegraph/following{/other_user}","gists_url":"https://api.github.com/users/telegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/telegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telegraph/subscriptions","organizations_url":"https://api.github.com/users/telegraph/orgs","repos_url":"https://api.github.com/users/telegraph/repos","events_url":"https://api.github.com/users/telegraph/events{/privacy}","received_events_url":"https://api.github.com/users/telegraph/received_events","type":"Organization","site_admin":false},"repo":{"id":85178800,"name":"tmg-utils","full_name":"telegraph/tmg-utils","owner":{"login":"telegraph","id":221228,"avatar_url":"https://avatars1.githubusercontent.com/u/221228?v=4","gravatar_id":"","url":"https://api.github.com/users/telegraph","html_url":"https://github.com/telegraph","followers_url":"https://api.github.com/users/telegraph/followers","following_url":"https://api.github.com/users/telegraph/following{/other_user}","gists_url":"https://api.github.com/users/telegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/telegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telegraph/subscriptions","organizations_url":"https://api.github.com/users/telegraph/orgs","repos_url":"https://api.github.com/users/telegraph/repos","events_url":"https://api.github.com/users/telegraph/events{/privacy}","received_events_url":"https://api.github.com/users/telegraph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telegraph/tmg-utils","description":"Telegraph Utilities","fork":false,"url":"https://api.github.com/repos/telegraph/tmg-utils","forks_url":"https://api.github.com/repos/telegraph/tmg-utils/forks","keys_url":"https://api.github.com/repos/telegraph/tmg-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telegraph/tmg-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telegraph/tmg-utils/teams","hooks_url":"https://api.github.com/repos/telegraph/tmg-utils/hooks","issue_events_url":"https://api.github.com/repos/telegraph/tmg-utils/issues/events{/number}","events_url":"https://api.github.com/repos/telegraph/tmg-utils/events","assignees_url":"https://api.github.com/repos/telegraph/tmg-utils/assignees{/user}","branches_url":"https://api.github.com/repos/telegraph/tmg-utils/branches{/branch}","tags_url":"https://api.github.com/repos/telegraph/tmg-utils/tags","blobs_url":"https://api.github.com/repos/telegraph/tmg-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telegraph/tmg-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telegraph/tmg-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/telegraph/tmg-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telegraph/tmg-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/telegraph/tmg-utils/languages","stargazers_url":"https://api.github.com/repos/telegraph/tmg-utils/stargazers","contributors_url":"https://api.github.com/repos/telegraph/tmg-utils/contributors","subscribers_url":"https://api.github.com/repos/telegraph/tmg-utils/subscribers","subscription_url":"https://api.github.com/repos/telegraph/tmg-utils/subscription","commits_url":"https://api.github.com/repos/telegraph/tmg-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/telegraph/tmg-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/telegraph/tmg-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/telegraph/tmg-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/telegraph/tmg-utils/contents/{+path}","compare_url":"https://api.github.com/repos/telegraph/tmg-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telegraph/tmg-utils/merges","archive_url":"https://api.github.com/repos/telegraph/tmg-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telegraph/tmg-utils/downloads","issues_url":"https://api.github.com/repos/telegraph/tmg-utils/issues{/number}","pulls_url":"https://api.github.com/repos/telegraph/tmg-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/telegraph/tmg-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/telegraph/tmg-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telegraph/tmg-utils/labels{/name}","releases_url":"https://api.github.com/repos/telegraph/tmg-utils/releases{/id}","deployments_url":"https://api.github.com/repos/telegraph/tmg-utils/deployments","created_at":"2017-03-16T09:41:44Z","updated_at":"2018-04-27T12:08:08Z","pushed_at":"2018-04-30T08:07:10Z","git_url":"git://github.com/telegraph/tmg-utils.git","ssh_url":"git@github.com:telegraph/tmg-utils.git","clone_url":"https://github.com/telegraph/tmg-utils.git","svn_url":"https://github.com/telegraph/tmg-utils","homepage":null,"size":159,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"telegraph:master","ref":"master","sha":"3b95e9254f0ebd0ebef74d013b096d09eada42ab","user":{"login":"telegraph","id":221228,"avatar_url":"https://avatars1.githubusercontent.com/u/221228?v=4","gravatar_id":"","url":"https://api.github.com/users/telegraph","html_url":"https://github.com/telegraph","followers_url":"https://api.github.com/users/telegraph/followers","following_url":"https://api.github.com/users/telegraph/following{/other_user}","gists_url":"https://api.github.com/users/telegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/telegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telegraph/subscriptions","organizations_url":"https://api.github.com/users/telegraph/orgs","repos_url":"https://api.github.com/users/telegraph/repos","events_url":"https://api.github.com/users/telegraph/events{/privacy}","received_events_url":"https://api.github.com/users/telegraph/received_events","type":"Organization","site_admin":false},"repo":{"id":85178800,"name":"tmg-utils","full_name":"telegraph/tmg-utils","owner":{"login":"telegraph","id":221228,"avatar_url":"https://avatars1.githubusercontent.com/u/221228?v=4","gravatar_id":"","url":"https://api.github.com/users/telegraph","html_url":"https://github.com/telegraph","followers_url":"https://api.github.com/users/telegraph/followers","following_url":"https://api.github.com/users/telegraph/following{/other_user}","gists_url":"https://api.github.com/users/telegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/telegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telegraph/subscriptions","organizations_url":"https://api.github.com/users/telegraph/orgs","repos_url":"https://api.github.com/users/telegraph/repos","events_url":"https://api.github.com/users/telegraph/events{/privacy}","received_events_url":"https://api.github.com/users/telegraph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telegraph/tmg-utils","description":"Telegraph Utilities","fork":false,"url":"https://api.github.com/repos/telegraph/tmg-utils","forks_url":"https://api.github.com/repos/telegraph/tmg-utils/forks","keys_url":"https://api.github.com/repos/telegraph/tmg-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telegraph/tmg-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telegraph/tmg-utils/teams","hooks_url":"https://api.github.com/repos/telegraph/tmg-utils/hooks","issue_events_url":"https://api.github.com/repos/telegraph/tmg-utils/issues/events{/number}","events_url":"https://api.github.com/repos/telegraph/tmg-utils/events","assignees_url":"https://api.github.com/repos/telegraph/tmg-utils/assignees{/user}","branches_url":"https://api.github.com/repos/telegraph/tmg-utils/branches{/branch}","tags_url":"https://api.github.com/repos/telegraph/tmg-utils/tags","blobs_url":"https://api.github.com/repos/telegraph/tmg-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telegraph/tmg-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telegraph/tmg-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/telegraph/tmg-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telegraph/tmg-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/telegraph/tmg-utils/languages","stargazers_url":"https://api.github.com/repos/telegraph/tmg-utils/stargazers","contributors_url":"https://api.github.com/repos/telegraph/tmg-utils/contributors","subscribers_url":"https://api.github.com/repos/telegraph/tmg-utils/subscribers","subscription_url":"https://api.github.com/repos/telegraph/tmg-utils/subscription","commits_url":"https://api.github.com/repos/telegraph/tmg-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/telegraph/tmg-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/telegraph/tmg-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/telegraph/tmg-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/telegraph/tmg-utils/contents/{+path}","compare_url":"https://api.github.com/repos/telegraph/tmg-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telegraph/tmg-utils/merges","archive_url":"https://api.github.com/repos/telegraph/tmg-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telegraph/tmg-utils/downloads","issues_url":"https://api.github.com/repos/telegraph/tmg-utils/issues{/number}","pulls_url":"https://api.github.com/repos/telegraph/tmg-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/telegraph/tmg-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/telegraph/tmg-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telegraph/tmg-utils/labels{/name}","releases_url":"https://api.github.com/repos/telegraph/tmg-utils/releases{/id}","deployments_url":"https://api.github.com/repos/telegraph/tmg-utils/deployments","created_at":"2017-03-16T09:41:44Z","updated_at":"2018-04-27T12:08:08Z","pushed_at":"2018-04-30T08:07:10Z","git_url":"git://github.com/telegraph/tmg-utils.git","ssh_url":"git@github.com:telegraph/tmg-utils.git","clone_url":"https://github.com/telegraph/tmg-utils.git","svn_url":"https://github.com/telegraph/tmg-utils","homepage":null,"size":159,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/telegraph/tmg-utils/pulls/9"},"html":{"href":"https://github.com/telegraph/tmg-utils/pull/9"},"issue":{"href":"https://api.github.com/repos/telegraph/tmg-utils/issues/9"},"comments":{"href":"https://api.github.com/repos/telegraph/tmg-utils/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/telegraph/tmg-utils/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/telegraph/tmg-utils/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/telegraph/tmg-utils/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/telegraph/tmg-utils/statuses/57337834216adb95778e1ccf115d11eb4f57c062"}},"author_association":"NONE"}}
{"actor":{"display_login":"iRhysBradbury"}}