{"action":"created","comment":{"url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/comments/90165707","pull_request_review_id":10688437,"id":90165707,"diff_hunk":"@@ -0,0 +1,42 @@\n+package smartthings.dw.timer;\n+\n+\n+import com.codahale.metrics.MetricRegistry;\n+import com.codahale.metrics.Timer;\n+import com.codahale.metrics.annotation.Timed;\n+import com.google.inject.Inject;\n+import org.aopalliance.intercept.MethodInterceptor;\n+import org.aopalliance.intercept.MethodInvocation;\n+\n+import java.lang.reflect.Method;\n+\n+public class MethodInvocationTimingInterceptor implements MethodInterceptor {\n+\n+    private MetricRegistry registry;\n+\n+    @Inject\n+    public void setRegistry(MetricRegistry registry) {\n+        this.registry = registry;\n+    }\n+\n+    @Override\n+    public Object invoke(MethodInvocation invocation) throws Throwable {\n+        Timed timedAnnotation = invocation.getMethod().getAnnotation(Timed.class);\n+        String name = findName(timedAnnotation.name(), invocation.getMethod());\n+\n+        Timer.Context ctx = registry.timer(name).time();\n+\n+        try {\n+            return invocation.proceed();\n+        } finally {\n+            ctx.stop();\n+        }\n+    }\n+\n+    private String findName(String name, Method method) {\n+        if (name == null || name.isEmpty()) {\n+            return method.getName();","path":"dropwizard-timer/src/main/java/smartthings/dw/timer/MethodInvocationTimingInterceptor.java","position":null,"original_position":38,"commit_id":"70687d421c74ecc1539b41d3ce8a4b561707ca89","original_commit_id":"d4d6e21d09234538b62597357050b0b4b98061ee","user":{"login":"mortent","id":8463,"avatar_url":"https://avatars.githubusercontent.com/u/8463?v=3","gravatar_id":"","url":"https://api.github.com/users/mortent","html_url":"https://github.com/mortent","followers_url":"https://api.github.com/users/mortent/followers","following_url":"https://api.github.com/users/mortent/following{/other_user}","gists_url":"https://api.github.com/users/mortent/gists{/gist_id}","starred_url":"https://api.github.com/users/mortent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mortent/subscriptions","organizations_url":"https://api.github.com/users/mortent/orgs","repos_url":"https://api.github.com/users/mortent/repos","events_url":"https://api.github.com/users/mortent/events{/privacy}","received_events_url":"https://api.github.com/users/mortent/received_events","type":"User","site_admin":false},"body":"Updated to behave identical to what happens when it is used on resources. This includes the naming of the metric. The behavior now is that without any attributes, the name of the metric will be class followed by method. If the `name` attribute is specified, the metric name will be class followed by the value of the `name` attribute. And if the `absolute` attribute is set to true, the name of the metric will be only what is specified in the `name` attribute","created_at":"2016-11-30T04:08:40Z","updated_at":"2016-11-30T04:08:40Z","html_url":"https://github.com/SmartThingsOSS/dropwizard-common/pull/9#discussion_r90165707","pull_request_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/comments/90165707"},"html":{"href":"https://github.com/SmartThingsOSS/dropwizard-common/pull/9#discussion_r90165707"},"pull_request":{"href":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/9","id":95787221,"html_url":"https://github.com/SmartThingsOSS/dropwizard-common/pull/9","diff_url":"https://github.com/SmartThingsOSS/dropwizard-common/pull/9.diff","patch_url":"https://github.com/SmartThingsOSS/dropwizard-common/pull/9.patch","issue_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/issues/9","number":9,"state":"open","locked":false,"title":"Module that allows the timed annotation to be used on other methods than resources","user":{"login":"mortent","id":8463,"avatar_url":"https://avatars.githubusercontent.com/u/8463?v=3","gravatar_id":"","url":"https://api.github.com/users/mortent","html_url":"https://github.com/mortent","followers_url":"https://api.github.com/users/mortent/followers","following_url":"https://api.github.com/users/mortent/following{/other_user}","gists_url":"https://api.github.com/users/mortent/gists{/gist_id}","starred_url":"https://api.github.com/users/mortent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mortent/subscriptions","organizations_url":"https://api.github.com/users/mortent/orgs","repos_url":"https://api.github.com/users/mortent/repos","events_url":"https://api.github.com/users/mortent/events{/privacy}","received_events_url":"https://api.github.com/users/mortent/received_events","type":"User","site_admin":false},"body":"@jeff-blaisdell","created_at":"2016-11-29T22:15:05Z","updated_at":"2016-11-30T04:08:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9603b7da62565f617cdd9973699549b7220d55e7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/9/commits","review_comments_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/9/comments","review_comment_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/issues/9/comments","statuses_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/statuses/70687d421c74ecc1539b41d3ce8a4b561707ca89","head":{"label":"mortent:TimerInterceptor","ref":"TimerInterceptor","sha":"70687d421c74ecc1539b41d3ce8a4b561707ca89","user":{"login":"mortent","id":8463,"avatar_url":"https://avatars.githubusercontent.com/u/8463?v=3","gravatar_id":"","url":"https://api.github.com/users/mortent","html_url":"https://github.com/mortent","followers_url":"https://api.github.com/users/mortent/followers","following_url":"https://api.github.com/users/mortent/following{/other_user}","gists_url":"https://api.github.com/users/mortent/gists{/gist_id}","starred_url":"https://api.github.com/users/mortent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mortent/subscriptions","organizations_url":"https://api.github.com/users/mortent/orgs","repos_url":"https://api.github.com/users/mortent/repos","events_url":"https://api.github.com/users/mortent/events{/privacy}","received_events_url":"https://api.github.com/users/mortent/received_events","type":"User","site_admin":false},"repo":{"id":75107763,"name":"dropwizard-common","full_name":"mortent/dropwizard-common","owner":{"login":"mortent","id":8463,"avatar_url":"https://avatars.githubusercontent.com/u/8463?v=3","gravatar_id":"","url":"https://api.github.com/users/mortent","html_url":"https://github.com/mortent","followers_url":"https://api.github.com/users/mortent/followers","following_url":"https://api.github.com/users/mortent/following{/other_user}","gists_url":"https://api.github.com/users/mortent/gists{/gist_id}","starred_url":"https://api.github.com/users/mortent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mortent/subscriptions","organizations_url":"https://api.github.com/users/mortent/orgs","repos_url":"https://api.github.com/users/mortent/repos","events_url":"https://api.github.com/users/mortent/events{/privacy}","received_events_url":"https://api.github.com/users/mortent/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mortent/dropwizard-common","description":"Common Dropwizard Modules","fork":true,"url":"https://api.github.com/repos/mortent/dropwizard-common","forks_url":"https://api.github.com/repos/mortent/dropwizard-common/forks","keys_url":"https://api.github.com/repos/mortent/dropwizard-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mortent/dropwizard-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mortent/dropwizard-common/teams","hooks_url":"https://api.github.com/repos/mortent/dropwizard-common/hooks","issue_events_url":"https://api.github.com/repos/mortent/dropwizard-common/issues/events{/number}","events_url":"https://api.github.com/repos/mortent/dropwizard-common/events","assignees_url":"https://api.github.com/repos/mortent/dropwizard-common/assignees{/user}","branches_url":"https://api.github.com/repos/mortent/dropwizard-common/branches{/branch}","tags_url":"https://api.github.com/repos/mortent/dropwizard-common/tags","blobs_url":"https://api.github.com/repos/mortent/dropwizard-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mortent/dropwizard-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mortent/dropwizard-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/mortent/dropwizard-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mortent/dropwizard-common/statuses/{sha}","languages_url":"https://api.github.com/repos/mortent/dropwizard-common/languages","stargazers_url":"https://api.github.com/repos/mortent/dropwizard-common/stargazers","contributors_url":"https://api.github.com/repos/mortent/dropwizard-common/contributors","subscribers_url":"https://api.github.com/repos/mortent/dropwizard-common/subscribers","subscription_url":"https://api.github.com/repos/mortent/dropwizard-common/subscription","commits_url":"https://api.github.com/repos/mortent/dropwizard-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/mortent/dropwizard-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/mortent/dropwizard-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/mortent/dropwizard-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/mortent/dropwizard-common/contents/{+path}","compare_url":"https://api.github.com/repos/mortent/dropwizard-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mortent/dropwizard-common/merges","archive_url":"https://api.github.com/repos/mortent/dropwizard-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mortent/dropwizard-common/downloads","issues_url":"https://api.github.com/repos/mortent/dropwizard-common/issues{/number}","pulls_url":"https://api.github.com/repos/mortent/dropwizard-common/pulls{/number}","milestones_url":"https://api.github.com/repos/mortent/dropwizard-common/milestones{/number}","notifications_url":"https://api.github.com/repos/mortent/dropwizard-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mortent/dropwizard-common/labels{/name}","releases_url":"https://api.github.com/repos/mortent/dropwizard-common/releases{/id}","deployments_url":"https://api.github.com/repos/mortent/dropwizard-common/deployments","created_at":"2016-11-29T17:59:37Z","updated_at":"2016-11-29T17:59:37Z","pushed_at":"2016-11-30T04:04:07Z","git_url":"git://github.com/mortent/dropwizard-common.git","ssh_url":"git@github.com:mortent/dropwizard-common.git","clone_url":"https://github.com/mortent/dropwizard-common.git","svn_url":"https://github.com/mortent/dropwizard-common","homepage":null,"size":122,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"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":"SmartThingsOSS:master","ref":"master","sha":"fd105abce266b7c1b700da7cf3a8977b94a971ce","user":{"login":"SmartThingsOSS","id":13473602,"avatar_url":"https://avatars.githubusercontent.com/u/13473602?v=3","gravatar_id":"","url":"https://api.github.com/users/SmartThingsOSS","html_url":"https://github.com/SmartThingsOSS","followers_url":"https://api.github.com/users/SmartThingsOSS/followers","following_url":"https://api.github.com/users/SmartThingsOSS/following{/other_user}","gists_url":"https://api.github.com/users/SmartThingsOSS/gists{/gist_id}","starred_url":"https://api.github.com/users/SmartThingsOSS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmartThingsOSS/subscriptions","organizations_url":"https://api.github.com/users/SmartThingsOSS/orgs","repos_url":"https://api.github.com/users/SmartThingsOSS/repos","events_url":"https://api.github.com/users/SmartThingsOSS/events{/privacy}","received_events_url":"https://api.github.com/users/SmartThingsOSS/received_events","type":"Organization","site_admin":false},"repo":{"id":67066170,"name":"dropwizard-common","full_name":"SmartThingsOSS/dropwizard-common","owner":{"login":"SmartThingsOSS","id":13473602,"avatar_url":"https://avatars.githubusercontent.com/u/13473602?v=3","gravatar_id":"","url":"https://api.github.com/users/SmartThingsOSS","html_url":"https://github.com/SmartThingsOSS","followers_url":"https://api.github.com/users/SmartThingsOSS/followers","following_url":"https://api.github.com/users/SmartThingsOSS/following{/other_user}","gists_url":"https://api.github.com/users/SmartThingsOSS/gists{/gist_id}","starred_url":"https://api.github.com/users/SmartThingsOSS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmartThingsOSS/subscriptions","organizations_url":"https://api.github.com/users/SmartThingsOSS/orgs","repos_url":"https://api.github.com/users/SmartThingsOSS/repos","events_url":"https://api.github.com/users/SmartThingsOSS/events{/privacy}","received_events_url":"https://api.github.com/users/SmartThingsOSS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SmartThingsOSS/dropwizard-common","description":"Common Dropwizard Modules","fork":false,"url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common","forks_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/forks","keys_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/teams","hooks_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/hooks","issue_events_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/issues/events{/number}","events_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/events","assignees_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/assignees{/user}","branches_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/branches{/branch}","tags_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/tags","blobs_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/git/refs{/sha}","trees_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/statuses/{sha}","languages_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/languages","stargazers_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/stargazers","contributors_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/contributors","subscribers_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/subscribers","subscription_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/subscription","commits_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/commits{/sha}","git_commits_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/git/commits{/sha}","comments_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/comments{/number}","issue_comment_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/issues/comments{/number}","contents_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/contents/{+path}","compare_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/merges","archive_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/downloads","issues_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/issues{/number}","pulls_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls{/number}","milestones_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/milestones{/number}","notifications_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/labels{/name}","releases_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/releases{/id}","deployments_url":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/deployments","created_at":"2016-08-31T19:15:27Z","updated_at":"2016-10-24T18:12:16Z","pushed_at":"2016-11-30T04:04:07Z","git_url":"git://github.com/SmartThingsOSS/dropwizard-common.git","ssh_url":"git@github.com:SmartThingsOSS/dropwizard-common.git","clone_url":"https://github.com/SmartThingsOSS/dropwizard-common.git","svn_url":"https://github.com/SmartThingsOSS/dropwizard-common","homepage":null,"size":119,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/9"},"html":{"href":"https://github.com/SmartThingsOSS/dropwizard-common/pull/9"},"issue":{"href":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/issues/9"},"comments":{"href":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/SmartThingsOSS/dropwizard-common/statuses/70687d421c74ecc1539b41d3ce8a4b561707ca89"}}}}
{"actor":{"display_login":"mortent"}}