You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by ts...@apache.org on 2016/03/16 17:56:20 UTC
[06/17] wicket git commit: Wicket Metrics - Component create / render
/ ResourceReference create
Wicket Metrics - Component create / render / ResourceReference create
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/b86851ea
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/b86851ea
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/b86851ea
Branch: refs/heads/master
Commit: b86851ea7a11420d1b2b60c0982df1c4139b8539
Parents: c4ac72e
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Thu Mar 10 15:12:33 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:11 2016 +0100
----------------------------------------------------------------------
.../metrics/aspects/ApplicationAspect.java | 2 +-
.../wicket/metrics/aspects/ComponentAspect.java | 72 ++++++++++++++++++++
.../wicket/metrics/aspects/PageAspect.java | 41 -----------
.../aspects/ResourceReferenceAspect.java | 49 +++++++++++++
.../src/main/resources/META-INF/aop.xml | 3 +-
5 files changed, 124 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/b86851ea/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ApplicationAspect.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ApplicationAspect.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ApplicationAspect.java
index 45fe51d..a2ee0dd 100644
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ApplicationAspect.java
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ApplicationAspect.java
@@ -39,7 +39,7 @@ public class ApplicationAspect extends WicketMetrics
* @return returns the boolean of the processRequest method
*
* @throws Throwable
- * might occure while invoking process request
+ * might occur while invoking process request
*/
@Around("execution(* org.apache.wicket.protocol.http.WicketFilter.processRequest(..))")
public Object aroundRequestProcessed(ProceedingJoinPoint joinPoint) throws Throwable
http://git-wip-us.apache.org/repos/asf/wicket/blob/b86851ea/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ComponentAspect.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ComponentAspect.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ComponentAspect.java
new file mode 100644
index 0000000..37d4e8e
--- /dev/null
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ComponentAspect.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.metrics.aspects;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+
+/**
+ * Gets information how often different components are rendered
+ *
+ * @author Tobias Soloschenko
+ */
+@Aspect
+public class ComponentAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often components are rendered
+ *
+ * @param joinPoint
+ * @return the object returned from the joinPoint
+ * @throws Throwable
+ */
+ @Around("target(org.apache.wicket.Component+) && execution(* onRender(..))")
+ public Object aroundRender(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/component/render/" + joinPoint.getTarget().getClass().getName(),
+ joinPoint);
+ }
+
+ /**
+ * Collects data how often components are created
+ *
+ * @param joinPoint
+ * the join point (component) which is created
+ * @return the object returned from the joinPoint
+ * @throws Throwable
+ * might occur while invoking process request
+ */
+ @Around("execution(org.apache.wicket.Component.new(..))")
+ public Object aroundNew(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ mark("core/component/create/" + joinPoint.getTarget().getClass().getName());
+ return joinPoint.proceed();
+ }
+
+ /**
+ * Collects data how often components redirect to another page
+ */
+ @Before("call(* org.apache.wicket.Component.setResponsePage(..))")
+ public void aroundResponsePage()
+ {
+ mark("core/component/redirect");
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/b86851ea/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/PageAspect.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/PageAspect.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/PageAspect.java
deleted file mode 100644
index 1f03d35..0000000
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/PageAspect.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.metrics.aspects;
-
-import org.apache.wicket.metrics.WicketMetrics;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-
-/**
- * Collects basic information about pages
- *
- * @author Tobias Soloschenko
- *
- */
-@Aspect
-public class PageAspect extends WicketMetrics
-{
-
- /**
- * Collects data how often a pages has been rendered
- */
- @Before("target(org.apache.wicket.Page+) && call(* onRender(..))")
- public void beforeRequestProcessed()
- {
- mark("core/page/render");
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/b86851ea/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ResourceReferenceAspect.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ResourceReferenceAspect.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ResourceReferenceAspect.java
new file mode 100644
index 0000000..1430ee7
--- /dev/null
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ResourceReferenceAspect.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.metrics.aspects;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Collects basic information about pages
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class ResourceReferenceAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often components are created
+ *
+ * @param joinPoint
+ * the join point (component) which is created
+ * @return the object returned from the joinPoint
+ * @throws Throwable
+ * might occur while invoking process request
+ */
+ @Around("execution(org.apache.wicket.request.resource.ResourceReference.new(..))")
+ public Object aroundNew(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ mark("core/resourceReference/create/" + joinPoint.getTarget().getClass().getName());
+ return joinPoint.proceed();
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/b86851ea/wicket-metrics/src/main/resources/META-INF/aop.xml
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/resources/META-INF/aop.xml b/wicket-metrics/src/main/resources/META-INF/aop.xml
index e9c48d1..eedd397 100644
--- a/wicket-metrics/src/main/resources/META-INF/aop.xml
+++ b/wicket-metrics/src/main/resources/META-INF/aop.xml
@@ -4,7 +4,8 @@
<include within="org.apache.wicket..*"/>
</weaver>
<aspects>
+ <aspect name="org.apache.wicket.metrics.aspects.ComponentAspect" />
<aspect name="org.apache.wicket.metrics.aspects.ApplicationAspect" />
- <aspect name="org.apache.wicket.metrics.aspects.PageAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.ResourceReferenceAspect" />
</aspects>
</aspectj>
\ No newline at end of file