{"action":"created","comment":{"url":"https://api.github.com/repos/apache/wicket/pulls/comments/55933641","id":55933641,"diff_hunk":"@@ -0,0 +1,162 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements.  See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * the License.  You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.apache.wicket.metrics;\n+\n+import org.aspectj.lang.ProceedingJoinPoint;\n+\n+import com.codahale.metrics.JmxReporter;\n+import com.codahale.metrics.MetricRegistry;\n+import com.codahale.metrics.Timer.Context;\n+\n+/**\n+ * Base aspect provides access to the metric registry\n+ * \n+ * @author Tobias Soloschenko\n+ *\n+ */\n+public class WicketMetrics\n+{\n+\n+\tprivate static MetricRegistry metricRegistry;\n+\n+\tprivate static boolean enabled = true;\n+\n+\tprivate static final String PREFIX = \"ApacheWicket/\";\n+\n+\t/**\n+\t * Gets the metric registry\n+\t * \n+\t * @return the metric registry\n+\t */\n+\tpublic static MetricRegistry getMetricRegistry()\n+\t{\n+\t\tif (metricRegistry == null)\n+\t\t{\n+\t\t\tmetricRegistry = new MetricRegistry();\n+\t\t}\n+\t\treturn metricRegistry;\n+\t}\n+\n+\t/**\n+\t * Simply measure the time for a {@literal @}around\n+\t * \n+\t * @param name\n+\t *            the name of the timer context\n+\t * @param joinPoint\n+\t *            the joinPoint to be proceed\n+\t * @return the value of the join point\n+\t * @throws Throwable\n+\t *             if there is an exception while execution\n+\t */\n+\tpublic Object measureTime(String name, ProceedingJoinPoint joinPoint) throws Throwable\n+\t{\n+\t\tif (WicketMetrics.enabled)\n+\t\t{\n+\t\t\tContext context = getMetricRegistry().timer(PREFIX + name + renderClassName(joinPoint))\n+\t\t\t\t.time();\n+\t\t\ttry\n+\t\t\t{\n+\t\t\t\treturn joinPoint.proceed();\n+\t\t\t}\n+\t\t\tfinally\n+\t\t\t{\n+\t\t\t\tstopQuietly(context);\n+\t\t\t}\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\treturn joinPoint.proceed();\n+\t\t}\n+\t}\n+\n+\t/**\n+\t * Marks the meter with the given name\n+\t * \n+\t * @param name\n+\t *            the name of the meter to be marked\n+\t * @param joinPoint\n+\t *            the join point\n+\t * @return the result of the proceeded join point\n+\t * @throws Throwable\n+\t */\n+\tpublic Object mark(String name, ProceedingJoinPoint joinPoint) throws Throwable","path":"wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java","position":96,"original_position":96,"commit_id":"b8ebc68a06e0c38ebc87a17cd4ae174d3a2c90b8","original_commit_id":"b8ebc68a06e0c38ebc87a17cd4ae174d3a2c90b8","user":{"login":"martin-g","id":232002,"avatar_url":"https://avatars.githubusercontent.com/u/232002?v=3","gravatar_id":"","url":"https://api.github.com/users/martin-g","html_url":"https://github.com/martin-g","followers_url":"https://api.github.com/users/martin-g/followers","following_url":"https://api.github.com/users/martin-g/following{/other_user}","gists_url":"https://api.github.com/users/martin-g/gists{/gist_id}","starred_url":"https://api.github.com/users/martin-g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martin-g/subscriptions","organizations_url":"https://api.github.com/users/martin-g/orgs","repos_url":"https://api.github.com/users/martin-g/repos","events_url":"https://api.github.com/users/martin-g/events{/privacy}","received_events_url":"https://api.github.com/users/martin-g/received_events","type":"User","site_admin":false},"body":"`mark` is a bit confusing. Why keep it `meter`? To be the same as what MetrictsRegistry uses.","created_at":"2016-03-13T08:19:29Z","updated_at":"2016-03-13T08:19:29Z","html_url":"https://github.com/apache/wicket/pull/164#discussion_r55933641","pull_request_url":"https://api.github.com/repos/apache/wicket/pulls/164","_links":{"self":{"href":"https://api.github.com/repos/apache/wicket/pulls/comments/55933641"},"html":{"href":"https://github.com/apache/wicket/pull/164#discussion_r55933641"},"pull_request":{"href":"https://api.github.com/repos/apache/wicket/pulls/164"}}},"pull_request":{"url":"https://api.github.com/repos/apache/wicket/pulls/164","id":62654843,"html_url":"https://github.com/apache/wicket/pull/164","diff_url":"https://github.com/apache/wicket/pull/164.diff","patch_url":"https://github.com/apache/wicket/pull/164.patch","issue_url":"https://api.github.com/repos/apache/wicket/issues/164","number":164,"state":"open","locked":false,"title":"wicket-metrics","user":{"login":"klopfdreh","id":980773,"avatar_url":"https://avatars.githubusercontent.com/u/980773?v=3","gravatar_id":"","url":"https://api.github.com/users/klopfdreh","html_url":"https://github.com/klopfdreh","followers_url":"https://api.github.com/users/klopfdreh/followers","following_url":"https://api.github.com/users/klopfdreh/following{/other_user}","gists_url":"https://api.github.com/users/klopfdreh/gists{/gist_id}","starred_url":"https://api.github.com/users/klopfdreh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klopfdreh/subscriptions","organizations_url":"https://api.github.com/users/klopfdreh/orgs","repos_url":"https://api.github.com/users/klopfdreh/repos","events_url":"https://api.github.com/users/klopfdreh/events{/privacy}","received_events_url":"https://api.github.com/users/klopfdreh/received_events","type":"User","site_admin":false},"body":"Just a PR to make the review easier. \r\n\r\nThe implementation was one of the ideas mentioned in the confluence page: https://cwiki.apache.org/confluence/display/WICKET/Ideas+for+Wicket+8.0\r\n\r\nTicket has to be created\r\n\r\n@martin-g - Is there a ticket for the metrics topic already?","created_at":"2016-03-12T22:47:37Z","updated_at":"2016-03-13T08:19:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d82f4446c470fbc2e0c8985fb53d9fbc3788cbc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/wicket/pulls/164/commits","review_comments_url":"https://api.github.com/repos/apache/wicket/pulls/164/comments","review_comment_url":"https://api.github.com/repos/apache/wicket/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/wicket/issues/164/comments","statuses_url":"https://api.github.com/repos/apache/wicket/statuses/b8ebc68a06e0c38ebc87a17cd4ae174d3a2c90b8","head":{"label":"klopfdreh:wicket_metrics","ref":"wicket_metrics","sha":"b8ebc68a06e0c38ebc87a17cd4ae174d3a2c90b8","user":{"login":"klopfdreh","id":980773,"avatar_url":"https://avatars.githubusercontent.com/u/980773?v=3","gravatar_id":"","url":"https://api.github.com/users/klopfdreh","html_url":"https://github.com/klopfdreh","followers_url":"https://api.github.com/users/klopfdreh/followers","following_url":"https://api.github.com/users/klopfdreh/following{/other_user}","gists_url":"https://api.github.com/users/klopfdreh/gists{/gist_id}","starred_url":"https://api.github.com/users/klopfdreh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klopfdreh/subscriptions","organizations_url":"https://api.github.com/users/klopfdreh/orgs","repos_url":"https://api.github.com/users/klopfdreh/repos","events_url":"https://api.github.com/users/klopfdreh/events{/privacy}","received_events_url":"https://api.github.com/users/klopfdreh/received_events","type":"User","site_admin":false},"repo":{"id":45333271,"name":"wicket","full_name":"klopfdreh/wicket","owner":{"login":"klopfdreh","id":980773,"avatar_url":"https://avatars.githubusercontent.com/u/980773?v=3","gravatar_id":"","url":"https://api.github.com/users/klopfdreh","html_url":"https://github.com/klopfdreh","followers_url":"https://api.github.com/users/klopfdreh/followers","following_url":"https://api.github.com/users/klopfdreh/following{/other_user}","gists_url":"https://api.github.com/users/klopfdreh/gists{/gist_id}","starred_url":"https://api.github.com/users/klopfdreh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klopfdreh/subscriptions","organizations_url":"https://api.github.com/users/klopfdreh/orgs","repos_url":"https://api.github.com/users/klopfdreh/repos","events_url":"https://api.github.com/users/klopfdreh/events{/privacy}","received_events_url":"https://api.github.com/users/klopfdreh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/klopfdreh/wicket","description":"Mirror of Apache Wicket","fork":true,"url":"https://api.github.com/repos/klopfdreh/wicket","forks_url":"https://api.github.com/repos/klopfdreh/wicket/forks","keys_url":"https://api.github.com/repos/klopfdreh/wicket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/klopfdreh/wicket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/klopfdreh/wicket/teams","hooks_url":"https://api.github.com/repos/klopfdreh/wicket/hooks","issue_events_url":"https://api.github.com/repos/klopfdreh/wicket/issues/events{/number}","events_url":"https://api.github.com/repos/klopfdreh/wicket/events","assignees_url":"https://api.github.com/repos/klopfdreh/wicket/assignees{/user}","branches_url":"https://api.github.com/repos/klopfdreh/wicket/branches{/branch}","tags_url":"https://api.github.com/repos/klopfdreh/wicket/tags","blobs_url":"https://api.github.com/repos/klopfdreh/wicket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/klopfdreh/wicket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/klopfdreh/wicket/git/refs{/sha}","trees_url":"https://api.github.com/repos/klopfdreh/wicket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/klopfdreh/wicket/statuses/{sha}","languages_url":"https://api.github.com/repos/klopfdreh/wicket/languages","stargazers_url":"https://api.github.com/repos/klopfdreh/wicket/stargazers","contributors_url":"https://api.github.com/repos/klopfdreh/wicket/contributors","subscribers_url":"https://api.github.com/repos/klopfdreh/wicket/subscribers","subscription_url":"https://api.github.com/repos/klopfdreh/wicket/subscription","commits_url":"https://api.github.com/repos/klopfdreh/wicket/commits{/sha}","git_commits_url":"https://api.github.com/repos/klopfdreh/wicket/git/commits{/sha}","comments_url":"https://api.github.com/repos/klopfdreh/wicket/comments{/number}","issue_comment_url":"https://api.github.com/repos/klopfdreh/wicket/issues/comments{/number}","contents_url":"https://api.github.com/repos/klopfdreh/wicket/contents/{+path}","compare_url":"https://api.github.com/repos/klopfdreh/wicket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/klopfdreh/wicket/merges","archive_url":"https://api.github.com/repos/klopfdreh/wicket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/klopfdreh/wicket/downloads","issues_url":"https://api.github.com/repos/klopfdreh/wicket/issues{/number}","pulls_url":"https://api.github.com/repos/klopfdreh/wicket/pulls{/number}","milestones_url":"https://api.github.com/repos/klopfdreh/wicket/milestones{/number}","notifications_url":"https://api.github.com/repos/klopfdreh/wicket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/klopfdreh/wicket/labels{/name}","releases_url":"https://api.github.com/repos/klopfdreh/wicket/releases{/id}","deployments_url":"https://api.github.com/repos/klopfdreh/wicket/deployments","created_at":"2015-11-01T09:30:31Z","updated_at":"2015-11-01T09:30:53Z","pushed_at":"2016-03-12T08:06:04Z","git_url":"git://github.com/klopfdreh/wicket.git","ssh_url":"git@github.com:klopfdreh/wicket.git","clone_url":"https://github.com/klopfdreh/wicket.git","svn_url":"https://github.com/klopfdreh/wicket","homepage":null,"size":103294,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"apache:master","ref":"master","sha":"90b8de4487dc8692acc145774925a511bc761ee8","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":206412,"name":"wicket","full_name":"apache/wicket","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/wicket","description":"Mirror of Apache Wicket","fork":false,"url":"https://api.github.com/repos/apache/wicket","forks_url":"https://api.github.com/repos/apache/wicket/forks","keys_url":"https://api.github.com/repos/apache/wicket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/wicket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/wicket/teams","hooks_url":"https://api.github.com/repos/apache/wicket/hooks","issue_events_url":"https://api.github.com/repos/apache/wicket/issues/events{/number}","events_url":"https://api.github.com/repos/apache/wicket/events","assignees_url":"https://api.github.com/repos/apache/wicket/assignees{/user}","branches_url":"https://api.github.com/repos/apache/wicket/branches{/branch}","tags_url":"https://api.github.com/repos/apache/wicket/tags","blobs_url":"https://api.github.com/repos/apache/wicket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/wicket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/wicket/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/wicket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/wicket/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/wicket/languages","stargazers_url":"https://api.github.com/repos/apache/wicket/stargazers","contributors_url":"https://api.github.com/repos/apache/wicket/contributors","subscribers_url":"https://api.github.com/repos/apache/wicket/subscribers","subscription_url":"https://api.github.com/repos/apache/wicket/subscription","commits_url":"https://api.github.com/repos/apache/wicket/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/wicket/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/wicket/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/wicket/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/wicket/contents/{+path}","compare_url":"https://api.github.com/repos/apache/wicket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/wicket/merges","archive_url":"https://api.github.com/repos/apache/wicket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/wicket/downloads","issues_url":"https://api.github.com/repos/apache/wicket/issues{/number}","pulls_url":"https://api.github.com/repos/apache/wicket/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/wicket/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/wicket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/wicket/labels{/name}","releases_url":"https://api.github.com/repos/apache/wicket/releases{/id}","deployments_url":"https://api.github.com/repos/apache/wicket/deployments","created_at":"2009-05-21T01:51:51Z","updated_at":"2016-03-08T22:37:29Z","pushed_at":"2016-03-12T23:27:12Z","git_url":"git://github.com/apache/wicket.git","ssh_url":"git@github.com:apache/wicket.git","clone_url":"https://github.com/apache/wicket.git","svn_url":"https://github.com/apache/wicket","homepage":null,"size":125167,"stargazers_count":311,"watchers_count":311,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":209,"mirror_url":"git://git.apache.org/wicket.git","open_issues_count":10,"forks":209,"open_issues":10,"watchers":311,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/wicket/pulls/164"},"html":{"href":"https://github.com/apache/wicket/pull/164"},"issue":{"href":"https://api.github.com/repos/apache/wicket/issues/164"},"comments":{"href":"https://api.github.com/repos/apache/wicket/issues/164/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/wicket/pulls/164/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/wicket/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/wicket/pulls/164/commits"},"statuses":{"href":"https://api.github.com/repos/apache/wicket/statuses/b8ebc68a06e0c38ebc87a17cd4ae174d3a2c90b8"}}}}