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:15 UTC
[01/17] wicket git commit: Wicket Metrics - Fixed errors on startup
Repository: wicket
Updated Branches:
refs/heads/master 6b23ce443 -> 07797740c
Wicket Metrics - Fixed errors on startup
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/fc85c033
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/fc85c033
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/fc85c033
Branch: refs/heads/master
Commit: fc85c033fe609b94377861af459be1f967fdbd1c
Parents: 4dbf8eb
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Thu Mar 10 13:27:22 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:08 2016 +0100
----------------------------------------------------------------------
wicket-metrics/src/main/resources/META-INF/aop.xml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/fc85c033/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 ba00763..e9c48d1 100644
--- a/wicket-metrics/src/main/resources/META-INF/aop.xml
+++ b/wicket-metrics/src/main/resources/META-INF/aop.xml
@@ -1,6 +1,8 @@
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
- <!-- <weaver options="-debug -showWeaveInfo -verbose"/> -->
+ <weaver options="-nowarn">
+ <include within="org.apache.wicket..*"/>
+ </weaver>
<aspects>
<aspect name="org.apache.wicket.metrics.aspects.ApplicationAspect" />
<aspect name="org.apache.wicket.metrics.aspects.PageAspect" />
[05/17] wicket git commit: Wicket Metrics - Switched create to time
measure
Posted by ts...@apache.org.
Wicket Metrics - Switched create to time measure
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/58c9fcbc
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/58c9fcbc
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/58c9fcbc
Branch: refs/heads/master
Commit: 58c9fcbce65029c02a05f19d1a2ebe022337c1d9
Parents: b86851e
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Thu Mar 10 15:16:38 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:11 2016 +0100
----------------------------------------------------------------------
.../java/org/apache/wicket/metrics/aspects/ComponentAspect.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/58c9fcbc/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
index 37d4e8e..65df92b 100644
--- 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
@@ -57,8 +57,8 @@ public class ComponentAspect extends WicketMetrics
@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();
+ return measureTime("core/component/create/" + joinPoint.getTarget().getClass().getName(),
+ joinPoint);
}
/**
[02/17] wicket git commit: Wicket Metrics
Posted by ts...@apache.org.
Wicket Metrics
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/4dbf8eb9
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/4dbf8eb9
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/4dbf8eb9
Branch: refs/heads/master
Commit: 4dbf8eb9829550d4bb26623dc314e7c8e8ec6116
Parents: 6b23ce4
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Thu Mar 10 11:40:39 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:08 2016 +0100
----------------------------------------------------------------------
README | 2 +
pom.xml | 19 +++++
wicket-metrics/pom.xml | 45 ++++++++++++
.../apache/wicket/metrics/WicketMetrics.java | 76 ++++++++++++++++++++
.../metrics/aspects/ApplicationAspect.java | 24 +++++++
.../wicket/metrics/aspects/PageAspect.java | 25 +++++++
.../src/main/resources/META-INF/aop.xml | 8 +++
7 files changed, 199 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/4dbf8eb9/README
----------------------------------------------------------------------
diff --git a/README b/README
index 436937c..45663f7 100644
--- a/README
+++ b/README
@@ -75,6 +75,7 @@ You will find the source code here:
|-- wicket-spring
|-- wicket-util
|-- wicket-user-guide
+ |-- wicket-metrics
`-- wicket-velocity
@@ -117,6 +118,7 @@ Here is a list of projects in this distribution and what they do.
- wicket-eclipse-settings: specifies Eclipse settings for a uniform development environment.
Most notably the formatting rules;
- wicket-user-guide: the user guide of wicket
+ - wicket-metrics: collects data of a running wicket application
Getting started
---------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/4dbf8eb9/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ff784f4..f4f84a1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -114,6 +114,7 @@
<module>wicket-bean-validation</module>
<module>wicket-cdi-1.1</module>
<module>wicket-user-guide</module>
+ <module>wicket-metrics</module>
</modules>
<properties>
<!-- Encoding -->
@@ -141,6 +142,8 @@
<objenesis.version>2.2</objenesis.version>
<!-- do not increase the version - wicket-user-guide requires 2.2.4 -->
<grails.version>2.2.4</grails.version>
+ <aspectj.version>1.8.8</aspectj.version>
+ <metrics.version>3.1.2</metrics.version>
</properties>
<dependencyManagement>
<dependencies>
@@ -403,6 +406,12 @@
<type>jar</type>
</dependency>
<dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-metrics</artifactId>
+ <version>8.0.0-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
<groupId>org.apache.wicket.experimental.wicket7</groupId>
<artifactId>wicket-atmosphere</artifactId>
<version>0.24-SNAPSHOT</version>
@@ -536,6 +545,16 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>${aspectj.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ <version>${metrics.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
<dependencies>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4dbf8eb9/wicket-metrics/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-metrics/pom.xml b/wicket-metrics/pom.xml
new file mode 100644
index 0000000..4ed79f1
--- /dev/null
+++ b/wicket-metrics/pom.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-parent</artifactId>
+ <version>8.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>wicket-metrics</artifactId>
+ <packaging>jar</packaging>
+ <name>Wicket Metrics</name>
+ <description>
+ Wicket’s implementation to show metric information
+ about web applications build on the web framework.
+ </description>
+ <dependencies>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/wicket/blob/4dbf8eb9/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
new file mode 100644
index 0000000..26314f0
--- /dev/null
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
@@ -0,0 +1,76 @@
+package org.apache.wicket.metrics;
+
+import com.codahale.metrics.JmxReporter;
+import com.codahale.metrics.MetricRegistry;
+
+/**
+ * Base aspect provides access to the metric registry
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+public class WicketMetrics
+{
+
+ private static MetricRegistry metricRegistry;
+
+ private static boolean enabled = true;
+
+ private static final String JMX_PREFIX = "ApacheWicket/";
+
+ /**
+ * Gets the metric registry
+ *
+ * @return the metric registry
+ */
+ public static MetricRegistry getMetricRegistry()
+ {
+ if (metricRegistry == null)
+ {
+ metricRegistry = new MetricRegistry();
+ }
+ return metricRegistry;
+ }
+
+
+ /**
+ * Marks the meter with the given name
+ *
+ * @param name
+ * the name of the meter to be marked
+ */
+ protected void mark(String name)
+ {
+ if (WicketMetrics.enabled)
+ {
+ getMetricRegistry().meter(JMX_PREFIX + name).mark();
+ }
+ }
+
+ /**
+ * Starts the jmx reporter
+ */
+ public static void startJmxReporter()
+ {
+ JmxReporter.forRegistry(getMetricRegistry()).build().start();
+ }
+
+ /**
+ * Stops the jmx reporter
+ */
+ public static void stopJmxReporter()
+ {
+ JmxReporter.forRegistry(getMetricRegistry()).build().stop();
+ }
+
+ /**
+ * If the metrics should be enabled
+ *
+ * @param enabled
+ * if the metrics should be enabled
+ */
+ public static void setEnabled(boolean enabled)
+ {
+ WicketMetrics.enabled = enabled;
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4dbf8eb9/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
new file mode 100644
index 0000000..2f56e50
--- /dev/null
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ApplicationAspect.java
@@ -0,0 +1,24 @@
+package org.apache.wicket.metrics.aspects;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+
+/**
+ * Aspect to handle basic web application information
+ *
+ * @author Tobias Soloschenko
+ */
+@Aspect
+public class ApplicationAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often a request has been made against the web app
+ */
+ @Before("call(* org.apache.wicket.protocol.http.WicketFilter.processRequest(..))")
+ public void beforeRequestProcessed()
+ {
+ mark("core/application/request");
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4dbf8eb9/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
new file mode 100644
index 0000000..4e85a36
--- /dev/null
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/PageAspect.java
@@ -0,0 +1,25 @@
+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/4dbf8eb9/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
new file mode 100644
index 0000000..ba00763
--- /dev/null
+++ b/wicket-metrics/src/main/resources/META-INF/aop.xml
@@ -0,0 +1,8 @@
+<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
+<aspectj>
+ <!-- <weaver options="-debug -showWeaveInfo -verbose"/> -->
+ <aspects>
+ <aspect name="org.apache.wicket.metrics.aspects.ApplicationAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.PageAspect" />
+ </aspects>
+</aspectj>
\ No newline at end of file
[06/17] wicket git commit: Wicket Metrics - Component create / render
/ ResourceReference create
Posted by ts...@apache.org.
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
[12/17] wicket git commit: Wicket Metrics - Moved to experimental /
doc improvements / aspects
Posted by ts...@apache.org.
Wicket Metrics - Moved to experimental / doc improvements / aspects
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/f14b1fb4
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/f14b1fb4
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/f14b1fb4
Branch: refs/heads/master
Commit: f14b1fb4aa56f0898a95f1d018ea816731a0b67c
Parents: f64a480
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Mon Mar 14 18:16:53 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:14 2016 +0100
----------------------------------------------------------------------
pom.xml | 5 +-
wicket-experimental/pom.xml | 2 +-
wicket-experimental/wicket-atmosphere/pom.xml | 3 +-
wicket-experimental/wicket-metrics/pom.xml | 49 ++++++
.../apache/wicket/metrics/WicketMetrics.java | 168 +++++++++++++++++++
.../wicket/metrics/WicketMetricsSettings.java | 87 ++++++++++
.../aspects/WicketFilterRequestCycleAspect.java | 49 ++++++
.../IPartialPageRequestHandlerAddAspect.java | 43 +++++
...ageRequestHandlerAppendJavaScriptAspect.java | 45 +++++
...geRequestHandlerPrependJavaScriptAspect.java | 44 +++++
.../aspects/behavior/BehaviorCreateAspect.java | 47 ++++++
.../component/ComponentCreateAspect.java | 47 ++++++
.../component/ComponentOnConfigureAspect.java | 48 ++++++
.../component/ComponentOnDetachAspect.java | 47 ++++++
.../component/ComponentOnInitializeAspect.java | 47 ++++++
.../component/ComponentOnRenderAspect.java | 48 ++++++
.../ComponentSetResponsePageAspect.java | 42 +++++
.../aspects/markup/WicketTagCreateAspect.java | 43 +++++
.../LoadableDetachableModelLoadAspect.java | 32 ++++
.../IRequestHandlerDetachAspect.java | 31 ++++
.../IRequestHandlerRespondAspect.java | 31 ++++
.../aspects/resource/IResourceCreateAspect.java | 30 ++++
.../resource/ResourceReferenceCreateAspect.java | 48 ++++++
.../main/resources/wicket-metrics.template.xml | 26 +++
wicket-metrics/pom.xml | 49 ------
.../apache/wicket/metrics/WicketMetrics.java | 168 -------------------
.../wicket/metrics/WicketMetricsSettings.java | 87 ----------
.../wicket/metrics/aspects/BehaviorAspect.java | 47 ------
.../wicket/metrics/aspects/ComponentAspect.java | 122 --------------
.../IPartialPageRequestHandlerAspect.java | 68 --------
.../aspects/ResourceReferenceAspect.java | 48 ------
.../metrics/aspects/WicketFilterAspect.java | 49 ------
.../src/docs/guide/monitoring/monitoring_1.gdoc | 30 +++-
.../src/docs/guide/monitoring/monitoring_2.gdoc | 31 +++-
.../src/docs/guide/monitoring/monitoring_4.gdoc | 33 ++++
wicket-user-guide/src/docs/guide/toc.yml | 3 +-
36 files changed, 1136 insertions(+), 661 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f4f84a1..05d565f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -114,7 +114,6 @@
<module>wicket-bean-validation</module>
<module>wicket-cdi-1.1</module>
<module>wicket-user-guide</module>
- <module>wicket-metrics</module>
</modules>
<properties>
<!-- Encoding -->
@@ -406,13 +405,13 @@
<type>jar</type>
</dependency>
<dependency>
- <groupId>org.apache.wicket</groupId>
+ <groupId>org.apache.wicket.experimental.wicket8</groupId>
<artifactId>wicket-metrics</artifactId>
<version>8.0.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
- <groupId>org.apache.wicket.experimental.wicket7</groupId>
+ <groupId>org.apache.wicket.experimental.wicket8</groupId>
<artifactId>wicket-atmosphere</artifactId>
<version>0.24-SNAPSHOT</version>
<type>jar</type>
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/pom.xml b/wicket-experimental/pom.xml
index e77b7d4..9f9922d 100644
--- a/wicket-experimental/pom.xml
+++ b/wicket-experimental/pom.xml
@@ -23,7 +23,7 @@
<version>8.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>org.apache.wicket.experimental.wicket7</groupId>
+ <groupId>org.apache.wicket.experimental.wicket8</groupId>
<artifactId>wicket-experimental</artifactId>
<packaging>pom</packaging>
<name>Wicket-Experimental</name>
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-atmosphere/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-atmosphere/pom.xml b/wicket-experimental/wicket-atmosphere/pom.xml
index dd8c108..bca4c36 100644
--- a/wicket-experimental/wicket-atmosphere/pom.xml
+++ b/wicket-experimental/wicket-atmosphere/pom.xml
@@ -18,13 +18,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.wicket.experimental.wicket7</groupId>
+ <groupId>org.apache.wicket.experimental.wicket8</groupId>
<artifactId>wicket-experimental</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>wicket-atmosphere</artifactId>
- <version>0.24-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Wicket-Atmosphere</name>
<description>Wicket-Atmosphere provides integration of the Atmosphere Framework in Wicket.</description>
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/pom.xml b/wicket-experimental/wicket-metrics/pom.xml
new file mode 100644
index 0000000..3ae5827
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.wicket.experimental.wicket8</groupId>
+ <artifactId>wicket-experimental</artifactId>
+ <version>8.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>wicket-metrics</artifactId>
+ <packaging>jar</packaging>
+ <name>Wicket Metrics</name>
+ <description>
+ Wicket’s implementation to show metric information
+ about web applications build on the web framework.
+ </description>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
new file mode 100644
index 0000000..4b4704d
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
@@ -0,0 +1,168 @@
+/*
+ * 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;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.MetaDataKey;
+import org.aspectj.lang.ProceedingJoinPoint;
+
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Timer.Context;
+
+/**
+ * Base aspect provides access to the metric registry
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+public class WicketMetrics
+{
+
+ /** The key for metrics registry **/
+ public static final MetaDataKey<MetricRegistry> METRIC_REGISTRY = new MetaDataKey<MetricRegistry>()
+ {
+ private static final long serialVersionUID = 1L;
+ };
+
+ /** The key for metrics registry **/
+ public static final MetaDataKey<WicketMetricsSettings> METRIC_SETTINGS = new MetaDataKey<WicketMetricsSettings>()
+ {
+ private static final long serialVersionUID = 1L;
+ };
+
+ /**
+ * Simply measure the time for a {@literal @}around
+ *
+ * @param name
+ * the name of the timer context
+ * @param joinPoint
+ * the joinPoint to be proceed
+ * @return the value of the join point
+ * @throws Throwable
+ * if there is an exception while execution
+ */
+ public Object measureTime(String name, ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ WicketMetricsSettings settings = getSettings();
+ MetricRegistry registry = getMetricRegistry();
+
+ if (settings.isEnabled())
+ {
+ Context context = registry
+ .timer(settings.getPrefix() + name + renderClassName(joinPoint)).time();
+ try
+ {
+ return joinPoint.proceed();
+ }
+ finally
+ {
+ stopQuietly(context);
+ }
+ }
+ else
+ {
+ return joinPoint.proceed();
+ }
+ }
+
+ /**
+ * Marks the meter with the given name
+ *
+ * @param name
+ * the name of the meter to be marked
+ * @param joinPoint
+ * the join point
+ * @return the result of the proceeded join point
+ * @throws Throwable
+ */
+ public Object mark(String name, ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ WicketMetricsSettings settings = getSettings();
+ MetricRegistry registry = getMetricRegistry();
+
+ if (settings.isEnabled())
+ {
+ registry.meter(settings.getPrefix() + name + renderClassName(joinPoint)).mark();
+ }
+ if (joinPoint != null)
+ {
+ return joinPoint.proceed();
+ }
+ return null;
+ }
+
+ /**
+ * Stops the context quietly
+ *
+ * @param context
+ * the context to stop
+ */
+ public void stopQuietly(Context context)
+ {
+ if (context != null)
+ {
+ context.stop();
+ }
+ }
+
+ /**
+ * Renders the class name of the given join point
+ *
+ * @param joinPoint
+ * the join point to get the class of
+ * @return the class name representation
+ */
+ public String renderClassName(ProceedingJoinPoint joinPoint)
+ {
+ return joinPoint != null
+ ? "/" + joinPoint.getTarget().getClass().getName().replace('.', '_') : "";
+ }
+
+ /**
+ * Gets the metric registry
+ *
+ * @return the metric registry
+ */
+ private static synchronized MetricRegistry getMetricRegistry()
+ {
+ Application application = Application.get();
+ MetricRegistry metricRegistry = application.getMetaData(METRIC_REGISTRY);
+ if (metricRegistry == null)
+ {
+ metricRegistry = new MetricRegistry();
+ application.setMetaData(METRIC_REGISTRY, metricRegistry);
+ }
+ return metricRegistry;
+ }
+
+ /**
+ * Gets the wicket metrics settings
+ *
+ * @return the wicket metrics settings
+ */
+ private static synchronized WicketMetricsSettings getSettings()
+ {
+ Application application = Application.get();
+ WicketMetricsSettings metricRegistry = application.getMetaData(METRIC_SETTINGS);
+ if (metricRegistry == null)
+ {
+ metricRegistry = new WicketMetricsSettings();
+ application.setMetaData(METRIC_SETTINGS, metricRegistry);
+ }
+ return metricRegistry;
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java
new file mode 100644
index 0000000..1bbaef2
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java
@@ -0,0 +1,87 @@
+/*
+ * 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;
+
+import org.apache.wicket.Application;
+
+import com.codahale.metrics.JmxReporter;
+import com.codahale.metrics.MetricRegistry;
+
+/**
+ * Settings to configure wicket metrics
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+public class WicketMetricsSettings
+{
+
+ private boolean enabled = true;
+
+ private String prefix = "ApacheWicket/";
+
+ /**
+ * If the metrics should be enabled
+ *
+ * @param enabled
+ * if the metrics should be enabled
+ */
+ public void setEnabled(boolean enabled)
+ {
+ this.enabled = enabled;
+ }
+
+ /**
+ * If the wicket metrics are enabled
+ *
+ * @return if the wicket metrics are enabled
+ */
+ public boolean isEnabled()
+ {
+ return enabled;
+ }
+
+ /**
+ * Gets the prefix.
+ *
+ * @return the prefix
+ */
+ public String getPrefix()
+ {
+ return prefix;
+ }
+
+ /**
+ * Starts the jmx reporter
+ */
+ public void startJmxReporter()
+ {
+ MetricRegistry metricRegistry = Application.get()
+ .getMetaData(WicketMetrics.METRIC_REGISTRY);
+ JmxReporter.forRegistry(metricRegistry).build().start();
+ }
+
+ /**
+ * Stops the jmx reporter
+ */
+ public void stopJmxReporter()
+ {
+ MetricRegistry metricRegistry = Application.get()
+ .getMetaData(WicketMetrics.METRIC_REGISTRY);
+ JmxReporter.forRegistry(metricRegistry).build().stop();
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterRequestCycleAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterRequestCycleAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterRequestCycleAspect.java
new file mode 100644
index 0000000..f7f7c0c
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterRequestCycleAspect.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;
+
+/**
+ * Aspect to handle basic web application information
+ *
+ * @author Tobias Soloschenko
+ */
+@Aspect
+public class WicketFilterRequestCycleAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often a request has been made against the webapp and counts the time how
+ * long the request remains
+ *
+ * @param joinPoint
+ * the joinPoint to be proceed
+ * @return returns the boolean of the processRequest method
+ *
+ * @throws Throwable
+ * might occur while invoking process request
+ */
+ @Around("execution(* org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(..))")
+ public Object aroundRequestProcessed(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/application/requestCycle", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerAddAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerAddAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerAddAspect.java
new file mode 100644
index 0000000..f14fe6d
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerAddAspect.java
@@ -0,0 +1,43 @@
+/*
+ * 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.ajax;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+
+/**
+ * Aspect which measures ajax request targets components to be requested for repaint
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class IPartialPageRequestHandlerAddAspect extends WicketMetrics
+{
+ /**
+ * Collects data how often components calls add
+ *
+ * @throws Throwable
+ * might occur while invoking add
+ */
+ @Before("call(* org.apache.wicket.core.request.handler.IPartialPageRequestHandler.add(..))")
+ public void beforeAdd() throws Throwable
+ {
+ mark("core/ajax/add", null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerAppendJavaScriptAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerAppendJavaScriptAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerAppendJavaScriptAspect.java
new file mode 100644
index 0000000..233c639
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerAppendJavaScriptAspect.java
@@ -0,0 +1,45 @@
+/*
+ * 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.ajax;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+
+/**
+ * Aspect which measures ajax request targets append java script metrics
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class IPartialPageRequestHandlerAppendJavaScriptAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often components calls appendJavaScript
+ *
+ * @throws Throwable
+ * might occur while invoking appendJavaScript
+ */
+ @Before("call(* org.apache.wicket.core.request.handler.IPartialPageRequestHandler.appendJavaScript(..))")
+ public void beforeAppendJavaScript() throws Throwable
+ {
+ mark("core/ajax/appendJavaScript", null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerPrependJavaScriptAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerPrependJavaScriptAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerPrependJavaScriptAspect.java
new file mode 100644
index 0000000..a1d183f
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ajax/IPartialPageRequestHandlerPrependJavaScriptAspect.java
@@ -0,0 +1,44 @@
+/*
+ * 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.ajax;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+
+/**
+ * Aspect measures checks ajax request targets prepent java script
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class IPartialPageRequestHandlerPrependJavaScriptAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often components calls prependJavaScript
+ *
+ * @throws Throwable
+ * might occur while invoking prependJavaScript
+ */
+ @Before("call(* org.apache.wicket.core.request.handler.IPartialPageRequestHandler.prependJavaScript(..))")
+ public void beforePrependJavaScript() throws Throwable
+ {
+ mark("core/ajax/prependJavaScript", null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/behavior/BehaviorCreateAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/behavior/BehaviorCreateAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/behavior/BehaviorCreateAspect.java
new file mode 100644
index 0000000..767d894
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/behavior/BehaviorCreateAspect.java
@@ -0,0 +1,47 @@
+/*
+ * 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.behavior;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Measures everything about behaviors
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class BehaviorCreateAspect extends WicketMetrics
+{
+ /**
+ * Collects data how often a behavior is created
+ *
+ * @param joinPoint
+ * the join point (behavior) which is created
+ * @return the result of constructor
+ * @throws Throwable
+ * might occur while creating a new behavior
+ */
+ @Around("execution(org.apache.wicket.behavior.Behavior.new(..))")
+ public Object aroundNew(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return mark("core/behavior/create", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentCreateAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentCreateAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentCreateAspect.java
new file mode 100644
index 0000000..318ef31
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentCreateAspect.java
@@ -0,0 +1,47 @@
+/*
+ * 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.component;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Gets information how often different components are created
+ *
+ * @author Tobias Soloschenko
+ */
+@Aspect
+public class ComponentCreateAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often components are created
+ *
+ * @param joinPoint
+ * the join point (component) which is created
+ * @return the object returned from the join point
+ * @throws Throwable
+ * might occur while constructing a new component
+ */
+ @Around("execution(org.apache.wicket.Component.new(..))")
+ public Object aroundNew(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/component/create", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnConfigureAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnConfigureAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnConfigureAspect.java
new file mode 100644
index 0000000..7058567
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnConfigureAspect.java
@@ -0,0 +1,48 @@
+/*
+ * 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.component;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Gets information how often different components are configured
+ *
+ * @author Tobias Soloschenko
+ */
+@Aspect
+public class ComponentOnConfigureAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often components calls onConfigure
+ *
+ * @param joinPoint
+ * the join point (component) which is configured
+ * @return the object returned from the join point
+ *
+ * @throws Throwable
+ * might occur while invoking onConfigure
+ */
+ @Around("execution(* org.apache.wicket.Component.onConfigure(..))")
+ public Object aroundOnConfigure(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/component/configure", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnDetachAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnDetachAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnDetachAspect.java
new file mode 100644
index 0000000..1abfd53
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnDetachAspect.java
@@ -0,0 +1,47 @@
+/*
+ * 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.component;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Gets information how often different components are detached
+ *
+ * @author Tobias Soloschenko
+ */
+@Aspect
+public class ComponentOnDetachAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often components calls onDetach
+ *
+ * @param joinPoint
+ * the join point (component) which is calling detach
+ * @return the object returned from the join point
+ * @throws Throwable
+ * might occur while invoking onDetach
+ */
+ @Around("execution(* org.apache.wicket.Component.onDetach(..))")
+ public Object arroundOnDetach(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return mark("core/component/detach", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnInitializeAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnInitializeAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnInitializeAspect.java
new file mode 100644
index 0000000..d2cca54
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnInitializeAspect.java
@@ -0,0 +1,47 @@
+/*
+ * 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.component;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Gets information how often different components are initialized
+ *
+ * @author Tobias Soloschenko
+ */
+@Aspect
+public class ComponentOnInitializeAspect extends WicketMetrics
+{
+ /**
+ * Collects data how often components calls onInitialize
+ *
+ * @param joinPoint
+ * the join point (component) which is initialized
+ * @return the object returned from the join point
+ *
+ * @throws Throwable
+ * might occur while invoking onInitialize
+ */
+ @Around("execution(* org.apache.wicket.Component.onInitialize(..))")
+ public Object aroundOnInitialize(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/component/initialize", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnRenderAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnRenderAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnRenderAspect.java
new file mode 100644
index 0000000..ad9bdfd
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentOnRenderAspect.java
@@ -0,0 +1,48 @@
+/*
+ * 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.component;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Gets information how often different components are rendered
+ *
+ * @author Tobias Soloschenko
+ */
+@Aspect
+public class ComponentOnRenderAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often components are rendered
+ *
+ * @param joinPoint
+ * the join point (component) which is rendered
+ * @return the object returned from the join point
+ * @throws Throwable
+ * might occur while onRender
+ */
+ @Around("execution(* org.apache.wicket.Component.onRender(..))")
+ public Object aroundOnRender(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/component/render", joinPoint);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentSetResponsePageAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentSetResponsePageAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentSetResponsePageAspect.java
new file mode 100644
index 0000000..7a80204
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/component/ComponentSetResponsePageAspect.java
@@ -0,0 +1,42 @@
+/*
+ * 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.component;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+
+/**
+ * Gets information how often different components are calling setResponsePage
+ *
+ * @author Tobias Soloschenko
+ */
+@Aspect
+public class ComponentSetResponsePageAspect extends WicketMetrics
+{
+ /**
+ * Collects data how often components redirect to another page
+ *
+ * @throws Throwable
+ * might occur while invoking setResponsePage
+ */
+ @Before("call(* org.apache.wicket.Component.setResponsePage(..))")
+ public void beforeResponsePage() throws Throwable
+ {
+ mark("core/component/redirect", null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/markup/WicketTagCreateAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/markup/WicketTagCreateAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/markup/WicketTagCreateAspect.java
new file mode 100644
index 0000000..2a2751a
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/markup/WicketTagCreateAspect.java
@@ -0,0 +1,43 @@
+/*
+ * 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.markup;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+
+/**
+ * Measures information about wicket tags
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class WicketTagCreateAspect extends WicketMetrics
+{
+ /**
+ * Collects data how often components redirect to another page
+ *
+ * @throws Throwable
+ * might occur while invoking setResponsePage
+ */
+ @Before("call(org.apache.wicket.markup.WicketTag.new(..))")
+ public void beforeResponsePage() throws Throwable
+ {
+ mark("core/tags/wicket/create", null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/model/LoadableDetachableModelLoadAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/model/LoadableDetachableModelLoadAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/model/LoadableDetachableModelLoadAspect.java
new file mode 100644
index 0000000..5b83de5
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/model/LoadableDetachableModelLoadAspect.java
@@ -0,0 +1,32 @@
+package org.apache.wicket.metrics.aspects.model;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Measures information about how long the loading process of the ldm take
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class LoadableDetachableModelLoadAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often a request handler calls detach
+ *
+ * @param joinPoint
+ * the join point (request handler) which processes the response
+ * @return the object returned from the join point
+ * @throws Throwable
+ * might occur while detach
+ */
+ @Around("execution(* org.apache.wicket.model.LoadableDetachableModel.load())")
+ public Object aroundOnRender(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/model/loadabledetachablemodel/load", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerDetachAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerDetachAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerDetachAspect.java
new file mode 100644
index 0000000..7c658b4
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerDetachAspect.java
@@ -0,0 +1,31 @@
+package org.apache.wicket.metrics.aspects.requesthandler;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Measures information about request handlers detach
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class IRequestHandlerDetachAspect extends WicketMetrics
+{
+ /**
+ * Collects data how often a request handler calls detach
+ *
+ * @param joinPoint
+ * the join point (request handler) which processes the response
+ * @return the object returned from the join point
+ * @throws Throwable
+ * might occur while detach
+ */
+ @Around("execution(* org.apache.wicket.request.IRequestHandler.detach(..))")
+ public Object aroundOnRender(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/requesthandler/detach", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerRespondAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerRespondAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerRespondAspect.java
new file mode 100644
index 0000000..45387f2
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerRespondAspect.java
@@ -0,0 +1,31 @@
+package org.apache.wicket.metrics.aspects.requesthandler;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Measures information about request handlers respond
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class IRequestHandlerRespondAspect extends WicketMetrics
+{
+ /**
+ * Collects data how often a request handler processes its response
+ *
+ * @param joinPoint
+ * the join point (request handler) which processes the response
+ * @return the object returned from the join point
+ * @throws Throwable
+ * might occur while respond
+ */
+ @Around("execution(* org.apache.wicket.request.IRequestHandler.respond(..))")
+ public Object aroundOnRender(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/requesthandler/respond", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/IResourceCreateAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/IResourceCreateAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/IResourceCreateAspect.java
new file mode 100644
index 0000000..7a5f1f7
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/IResourceCreateAspect.java
@@ -0,0 +1,30 @@
+package org.apache.wicket.metrics.aspects.resource;
+
+import org.apache.wicket.metrics.WicketMetrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Measures how often a resource is created
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class IResourceCreateAspect extends WicketMetrics
+{
+ /**
+ * Collects data how often a resource reference is created
+ *
+ * @param joinPoint
+ * the join point (resource reference) which is created
+ * @return the result of constructor
+ * @throws Throwable
+ * might occur while creating a new resource reference
+ */
+ @Around("execution(org.apache.wicket.request.resource.IResource.new(..))")
+ public Object aroundNew(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return mark("core/resource/resource/create", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/ResourceReferenceCreateAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/ResourceReferenceCreateAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/ResourceReferenceCreateAspect.java
new file mode 100644
index 0000000..b14af58
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/ResourceReferenceCreateAspect.java
@@ -0,0 +1,48 @@
+/*
+ * 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.resource;
+
+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 ResourceReferenceCreateAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often a resource reference is created
+ *
+ * @param joinPoint
+ * the join point (resource reference) which is created
+ * @return the result of constructor
+ * @throws Throwable
+ * might occur while creating a new resource reference
+ */
+ @Around("execution(org.apache.wicket.request.resource.ResourceReference.new(..))")
+ public Object aroundNew(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return mark("core/resource/reference/create", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-experimental/wicket-metrics/src/main/resources/wicket-metrics.template.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/resources/wicket-metrics.template.xml b/wicket-experimental/wicket-metrics/src/main/resources/wicket-metrics.template.xml
new file mode 100644
index 0000000..e59cb51
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/resources/wicket-metrics.template.xml
@@ -0,0 +1,26 @@
+<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
+<aspectj>
+ <weaver options="-nowarn">
+ <include within="org.apache.wicket..*"/>
+ <include within="com.fluentsqaure..*"/>
+ </weaver>
+ <aspects>
+ <aspect name="org.apache.wicket.metrics.aspects.model.LoadableDetachableModelLoadAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.requesthandler.IRequestHandlerDetachAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.requesthandler.IRequestHandlerRespondAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.resource.IResourceCreateAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.behavior.BehaviorCreateAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentCreateAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnConfigureAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnDetachAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnInitializeAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnRenderAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentSetResponsePageAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.ajax.IPartialPageRequestHandlerAddAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.ajax.IPartialPageRequestHandlerAppendJavaScriptAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.ajax.IPartialPageRequestHandlerPrependJavaScriptAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.resource.ResourceReferenceCreateAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.markup.WicketTagCreateAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.WicketFilterRequestCycleAspect" />
+ </aspects>
+</aspectj>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-metrics/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-metrics/pom.xml b/wicket-metrics/pom.xml
deleted file mode 100644
index a3a6a5b..0000000
--- a/wicket-metrics/pom.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.wicket</groupId>
- <artifactId>wicket-parent</artifactId>
- <version>8.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>wicket-metrics</artifactId>
- <packaging>jar</packaging>
- <name>Wicket Metrics</name>
- <description>
- Wicket’s implementation to show metric information
- about web applications build on the web framework.
- </description>
- <dependencies>
- <dependency>
- <groupId>org.apache.wicket</groupId>
- <artifactId>wicket-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>io.dropwizard.metrics</groupId>
- <artifactId>metrics-core</artifactId>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
deleted file mode 100644
index 51e55c5..0000000
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
+++ /dev/null
@@ -1,168 +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;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.MetaDataKey;
-import org.aspectj.lang.ProceedingJoinPoint;
-
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.Timer.Context;
-
-/**
- * Base aspect provides access to the metric registry
- *
- * @author Tobias Soloschenko
- *
- */
-public class WicketMetrics
-{
-
- /** The key for metrics registry **/
- public static final MetaDataKey<MetricRegistry> METRIC_REGISTRY = new MetaDataKey<MetricRegistry>()
- {
- private static final long serialVersionUID = 1L;
- };
-
- /** The key for metrics registry **/
- public static final MetaDataKey<WicketMetricsSettings> METRIC_SETTINGS = new MetaDataKey<WicketMetricsSettings>()
- {
- private static final long serialVersionUID = 1L;
- };
-
- /**
- * Simply measure the time for a {@literal @}around
- *
- * @param name
- * the name of the timer context
- * @param joinPoint
- * the joinPoint to be proceed
- * @return the value of the join point
- * @throws Throwable
- * if there is an exception while execution
- */
- public Object measureTime(String name, ProceedingJoinPoint joinPoint) throws Throwable
- {
- WicketMetricsSettings settings = getSettings();
- MetricRegistry registry = getMetricRegistry();
-
- if (settings.isEnabled())
- {
- Context context = registry
- .timer(settings.getPrefix() + name + renderClassName(joinPoint)).time();
- try
- {
- return joinPoint.proceed();
- }
- finally
- {
- stopQuietly(context);
- }
- }
- else
- {
- return joinPoint.proceed();
- }
- }
-
- /**
- * Marks the meter with the given name
- *
- * @param name
- * the name of the meter to be marked
- * @param joinPoint
- * the join point
- * @return the result of the proceeded join point
- * @throws Throwable
- */
- public Object mark(String name, ProceedingJoinPoint joinPoint) throws Throwable
- {
- WicketMetricsSettings settings = getSettings();
- MetricRegistry registry = getMetricRegistry();
-
- if (settings.isEnabled())
- {
- registry.meter(settings.getPrefix() + name + renderClassName(joinPoint)).mark();
- }
- if (joinPoint != null)
- {
- return joinPoint.proceed();
- }
- return null;
- }
-
- /**
- * Stops the context quietly
- *
- * @param context
- * the context to stop
- */
- public void stopQuietly(Context context)
- {
- if (context != null)
- {
- context.stop();
- }
- }
-
- /**
- * Renders the class name of the given join point
- *
- * @param joinPoint
- * the join point to get the class of
- * @return the class name representation
- */
- public String renderClassName(ProceedingJoinPoint joinPoint)
- {
- return joinPoint != null
- ? "/" + joinPoint.getTarget().getClass().getName().replace('.', '_') : "";
- }
-
- /**
- * Gets the metric registry
- *
- * @return the metric registry
- */
- private MetricRegistry getMetricRegistry()
- {
- Application application = Application.get();
- MetricRegistry metricRegistry = application.getMetaData(METRIC_REGISTRY);
- if (metricRegistry == null)
- {
- metricRegistry = new MetricRegistry();
- application.setMetaData(METRIC_REGISTRY, metricRegistry);
- }
- return metricRegistry;
- }
-
- /**
- * Gets the wicket metrics settings
- *
- * @return the wicket metrics settings
- */
- private WicketMetricsSettings getSettings()
- {
- Application application = Application.get();
- WicketMetricsSettings metricRegistry = application.getMetaData(METRIC_SETTINGS);
- if (metricRegistry == null)
- {
- metricRegistry = new WicketMetricsSettings();
- application.setMetaData(METRIC_SETTINGS, metricRegistry);
- }
- return metricRegistry;
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java
deleted file mode 100644
index 1bbaef2..0000000
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java
+++ /dev/null
@@ -1,87 +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;
-
-import org.apache.wicket.Application;
-
-import com.codahale.metrics.JmxReporter;
-import com.codahale.metrics.MetricRegistry;
-
-/**
- * Settings to configure wicket metrics
- *
- * @author Tobias Soloschenko
- *
- */
-public class WicketMetricsSettings
-{
-
- private boolean enabled = true;
-
- private String prefix = "ApacheWicket/";
-
- /**
- * If the metrics should be enabled
- *
- * @param enabled
- * if the metrics should be enabled
- */
- public void setEnabled(boolean enabled)
- {
- this.enabled = enabled;
- }
-
- /**
- * If the wicket metrics are enabled
- *
- * @return if the wicket metrics are enabled
- */
- public boolean isEnabled()
- {
- return enabled;
- }
-
- /**
- * Gets the prefix.
- *
- * @return the prefix
- */
- public String getPrefix()
- {
- return prefix;
- }
-
- /**
- * Starts the jmx reporter
- */
- public void startJmxReporter()
- {
- MetricRegistry metricRegistry = Application.get()
- .getMetaData(WicketMetrics.METRIC_REGISTRY);
- JmxReporter.forRegistry(metricRegistry).build().start();
- }
-
- /**
- * Stops the jmx reporter
- */
- public void stopJmxReporter()
- {
- MetricRegistry metricRegistry = Application.get()
- .getMetaData(WicketMetrics.METRIC_REGISTRY);
- JmxReporter.forRegistry(metricRegistry).build().stop();
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/BehaviorAspect.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/BehaviorAspect.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/BehaviorAspect.java
deleted file mode 100644
index 94cc60c..0000000
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/BehaviorAspect.java
+++ /dev/null
@@ -1,47 +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.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-
-/**
- * Measures everything about behaviors
- *
- * @author Tobias Soloschenko
- *
- */
-@Aspect
-public class BehaviorAspect extends WicketMetrics
-{
- /**
- * Collects data how often a behavior is created
- *
- * @param joinPoint
- * the join point (behavior) which is created
- * @return the result of constructor
- * @throws Throwable
- * might occur while creating a new behavior
- */
- @Around("execution(org.apache.wicket.behavior.Behavior.new(..))")
- public Object aroundNew(ProceedingJoinPoint joinPoint) throws Throwable
- {
- return mark("core/behavior/create", joinPoint);
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/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
deleted file mode 100644
index e046a63..0000000
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ComponentAspect.java
+++ /dev/null
@@ -1,122 +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.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
- * the join point (component) which is rendered
- * @return the object returned from the join point
- * @throws Throwable
- * might occur while onRender
- */
- @Around("execution(* org.apache.wicket.Component.onRender(..))")
- public Object aroundOnRender(ProceedingJoinPoint joinPoint) throws Throwable
- {
- return measureTime("core/component/render", joinPoint);
- }
-
- /**
- * Collects data how often components are created
- *
- * @param joinPoint
- * the join point (component) which is created
- * @return the object returned from the join point
- * @throws Throwable
- * might occur while constructing a new component
- */
- @Around("execution(org.apache.wicket.Component.new(..))")
- public Object aroundNew(ProceedingJoinPoint joinPoint) throws Throwable
- {
- return measureTime("core/component/create", joinPoint);
- }
-
- /**
- * Collects data how often components calls onConfigure
- *
- * @param joinPoint
- * the join point (component) which is configured
- * @return the object returned from the join point
- *
- * @throws Throwable
- * might occur while invoking onConfigure
- */
- @Around("execution(* org.apache.wicket.Component.onConfigure(..))")
- public Object aroundOnConfigure(ProceedingJoinPoint joinPoint) throws Throwable
- {
- return measureTime("core/component/configure", joinPoint);
- }
-
- /**
- * Collects data how often components calls onInitialize
- *
- * @param joinPoint
- * the join point (component) which is initialized
- * @return the object returned from the join point
- *
- * @throws Throwable
- * might occur while invoking onInitialize
- */
- @Around("execution(* org.apache.wicket.Component.onInitialize(..))")
- public Object aroundOnInitialize(ProceedingJoinPoint joinPoint) throws Throwable
- {
- return measureTime("core/component/initialize", joinPoint);
- }
-
- /**
- * Collects data how often components calls onDetach
- *
- * @param joinPoint
- * the join point (component) which is calling detach
- * @return the object returned from the join point
- * @throws Throwable
- * might occur while invoking onDetach
- */
- @Around("execution(* org.apache.wicket.Component.onDetach(..))")
- public Object arroundOnDetach(ProceedingJoinPoint joinPoint) throws Throwable
- {
- return mark("core/component/detach", joinPoint);
- }
-
- /**
- * Collects data how often components redirect to another page
- *
- * @throws Throwable
- * might occur while invoking setResponsePage
- */
- @Before("call(* org.apache.wicket.Component.setResponsePage(..))")
- public void beforeResponsePage() throws Throwable
- {
- mark("core/component/redirect", null);
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/IPartialPageRequestHandlerAspect.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/IPartialPageRequestHandlerAspect.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/IPartialPageRequestHandlerAspect.java
deleted file mode 100644
index 24cb2a1..0000000
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/IPartialPageRequestHandlerAspect.java
+++ /dev/null
@@ -1,68 +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;
-
-/**
- * Aspect which checks ajax request targets
- *
- * @author Tobias Soloschenko
- *
- */
-@Aspect
-public class IPartialPageRequestHandlerAspect extends WicketMetrics
-{
- /**
- * Collects data how often components calls add
- *
- * @throws Throwable
- * might occur while invoking add
- */
- @Before("call(* org.apache.wicket.core.request.handler.IPartialPageRequestHandler.add(..))")
- public void beforeAdd() throws Throwable
- {
- mark("core/ajax/add", null);
- }
-
- /**
- * Collects data how often components calls prependJavaScript
- *
- * @throws Throwable
- * might occur while invoking prependJavaScript
- */
- @Before("call(* org.apache.wicket.core.request.handler.IPartialPageRequestHandler.prependJavaScript(..))")
- public void beforePrependJavaScript() throws Throwable
- {
- mark("core/ajax/prependJavaScript", null);
- }
-
- /**
- * Collects data how often components calls appendJavaScript
- *
- * @throws Throwable
- * might occur while invoking appendJavaScript
- */
- @Before("call(* org.apache.wicket.core.request.handler.IPartialPageRequestHandler.appendJavaScript(..))")
- public void beforeAppendJavaScript() throws Throwable
- {
- mark("core/ajax/appendJavaScript", null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/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
deleted file mode 100644
index cd11e54..0000000
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ResourceReferenceAspect.java
+++ /dev/null
@@ -1,48 +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.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 a resource reference is created
- *
- * @param joinPoint
- * the join point (resource reference) which is created
- * @return the result of constructor
- * @throws Throwable
- * might occur while creating a new resource reference
- */
- @Around("execution(org.apache.wicket.request.resource.ResourceReference.new(..))")
- public Object aroundNew(ProceedingJoinPoint joinPoint) throws Throwable
- {
- return mark("core/resource/create", joinPoint);
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java
deleted file mode 100644
index c71430c..0000000
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java
+++ /dev/null
@@ -1,49 +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.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-
-/**
- * Aspect to handle basic web application information
- *
- * @author Tobias Soloschenko
- */
-@Aspect
-public class WicketFilterAspect extends WicketMetrics
-{
-
- /**
- * Collects data how often a request has been made against the webapp and counts the time how
- * long the request remains
- *
- * @param joinPoint
- * the joinPoint to be proceed
- * @return returns the boolean of the processRequest method
- *
- * @throws Throwable
- * might occur while invoking process request
- */
- @Around("execution(* org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(..))")
- public Object aroundRequestProcessed(ProceedingJoinPoint joinPoint) throws Throwable
- {
- return measureTime("core/application/requestCycle", joinPoint);
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
index 6d2dab5..d63186d 100644
--- a/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
@@ -3,7 +3,7 @@ This is a little example how to setup wicket-metrics within a Apache Tomcat.
(1) Add the maven dependency to your project
{code}
<dependency>
- <groupId>org.apache.wicket</groupId>
+ <groupId>org.apache.wicket.experimental.wicket8</groupId>
<artifactId>wicket-metrics</artifactId>
<version>${wicket.version}</version>
</dependency>
@@ -13,7 +13,7 @@ This is a little example how to setup wicket-metrics within a Apache Tomcat.
(3) Add the java agent to the jvm start options of your tomcat: -javaagent:/pathToServer/lib/aspectjweaver-x.x.x.jar
-(4) Add an aop.xml to your project with the metrics you want to use (aspect tags) - if you don't want to enable a metrics just remove the aspect tag:
+(4) Add an aop.xml to your project's META-INF folder at the root of your classpath with the metrics you want to use (aspect tags) - if you don't want to enable a metrics just remove the aspect tag:
{code}
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
@@ -21,15 +21,31 @@ This is a little example how to setup wicket-metrics within a Apache Tomcat.
<include within="org.apache.wicket..*"/>
</weaver>
<aspects>
- <aspect name="org.apache.wicket.metrics.aspects.BehaviorAspect" />
- <aspect name="org.apache.wicket.metrics.aspects.IPartialPageRequestHandlerAspect" />
- <aspect name="org.apache.wicket.metrics.aspects.ComponentAspect" />
- <aspect name="org.apache.wicket.metrics.aspects.WicketFilterAspect" />
- <aspect name="org.apache.wicket.metrics.aspects.ResourceReferenceAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.model.LoadableDetachableModelLoadAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.requesthandler.IRequestHandlerDetachAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.requesthandler.IRequestHandlerRespondAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.resource.IResourceCreateAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.behavior.BehaviorCreateAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentCreateAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnConfigureAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnDetachAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnInitializeAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnRenderAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.component.ComponentSetResponsePageAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.ajax.IPartialPageRequestHandlerAddAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.ajax.IPartialPageRequestHandlerAppendJavaScriptAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.ajax.IPartialPageRequestHandlerPrependJavaScriptAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.resource.ResourceReferenceCreateAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.markup.WicketTagCreateAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.WicketFilterRequestCycleAspect" />
</aspects>
</aspectj>
{code}
+* If you have set wicket-metrics as dependency you can open "wicket-metrics.template.xml" to get a full template of the "aop.xml"
+
+* For the weaver options refer to the "AspectJ LTW configuration documentation":https://eclipse.org/aspectj/doc/next/devguide/ltw-configuration.html
+
(5 - optional) To enable the JMX measurement write the following line into your init method of your Application (Now you are able to connect with jvisualvm to your server and have a look at the data):
{code}
Application.get().getMetaData(WicketMetrics.METRIC_SETTINGS).startJmxReporter();
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
index be330ce..e404345 100644
--- a/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
@@ -1,5 +1,6 @@
To visualize the metrics with Graphite a little additional configuration is required:
+
(1) Add the additional maven dependency to your project:
{code}
<dependency>
@@ -11,15 +12,27 @@ To visualize the metrics with Graphite a little additional configuration is requ
(2) Add the following code to your Application's init method:
{code}
-MetricRegistry metricRegistry = Application.get().getMetaData(WicketMetrics.METRIC_REGISTRY)
-final Graphite graphite = new Graphite(new InetSocketAddress("127.0.0.1", 2003));
-final GraphiteReporter reporter = GraphiteReporter.forRegistry(metricRegistry)
- .prefixedWith("WebApplications")
- .convertRatesTo(TimeUnit.SECONDS)
- .convertDurationsTo(TimeUnit.MILLISECONDS)
- .filter(MetricFilter.ALL)
- .build(graphite);
-reporter.start(1, TimeUnit.SECONDS);
+ private GraphiteReporter reporter;
+
+ @Override
+ protected void init()
+ {
+ MetricRegistry metricRegistry = this.getMetaData(WicketMetrics.METRIC_REGISTRY);
+ final Graphite graphite = new Graphite(new InetSocketAddress("127.0.0.1", 2003));
+ reporter = GraphiteReporter.forRegistry(metricRegistry).prefixedWith("WebApplications")
+ .convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS)
+ .filter(MetricFilter.ALL).build(graphite);
+
+ // Collects data every 5 seconds
+ reporter.start(5, TimeUnit.SECONDS);
+ }
+
+ @Override
+ protected void onDestroy()
+ {
+ super.onDestroy();
+ reporter.stop();
+ }
{code}
(3) Install and setup graphite on your system. Example installation for mac (beware that this is only a quickstart setup!):
[11/17] wicket git commit: Wicket Metrics - Moved to experimental /
doc improvements / aspects
Posted by ts...@apache.org.
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-user-guide/src/docs/guide/monitoring/monitoring_4.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_4.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_4.gdoc
new file mode 100644
index 0000000..004b26d
--- /dev/null
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_4.gdoc
@@ -0,0 +1,33 @@
+There are only a two steps required to write own measurements for life data statistics in wicket:
+
+(1) Write a class which is named very close to what it measures. This class should extends WicketMetrics and should annotated with @Aspect and provide one method with a join point scanning for the target signature.
+{code}
+ @Aspect
+ public class MySpecialAspect extends WicketMetrics
+ {
+ @Around("execution(* my.package.MyClass.myMethod(..))")
+ public Object aroundRequestProcessed(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("mycategory/someinformation/", joinPoint);
+ }
+ }
+{code}
+* To measure time you need @Around because measureTime of WicketMetrics requires the joinPoint - the class name is appended with a slash at the end
+
+* To only mark that a method is called you can use mark of WicketMetrics and apply null as a second parameter - if you apply a join point to mark the class name is appended with a slash at the end
+
+(2) Add the class to your aop.xml and of course the package to scan for classes that are target for your measurements:
+{code}
+<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
+<aspectj>
+ <weaver options="-nowarn">
+ <include within="org.apache.wicket..*"/>
+ <include within="my.package..*"/>
+ </weaver>
+ <aspects>
+ <aspect name="my.package.MySpecialAspect" />
+ <!-- wickets own metrics -->
+ .....
+ </aspects>
+</aspectj>
+{code}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-user-guide/src/docs/guide/toc.yml
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/toc.yml b/wicket-user-guide/src/docs/guide/toc.yml
index dab016e..303903c 100644
--- a/wicket-user-guide/src/docs/guide/toc.yml
+++ b/wicket-user-guide/src/docs/guide/toc.yml
@@ -224,10 +224,11 @@ wicketstuff:
wicketstuff_6: Module wicketstuff-rest-annotations
wicketstuff_7: Module stateless
monitoring:
- title: Wicket Metrics Monitoring
+ title: Wicket Metrics Monitoring (Experimental)
monitoring_1: Example setup
monitoring_2: Visualization with Graphite
monitoring_3: Measured data
+ monitoring_4: Write own measurements
redirects:
title: Lost In Redirection With Apache Wicket (Appendix)
contributing:
[13/17] wicket git commit: Wicket Metrics - Added the project as
module
Posted by ts...@apache.org.
Wicket Metrics - Added the project as module
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/bb94964c
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/bb94964c
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/bb94964c
Branch: refs/heads/master
Commit: bb94964ce0f2405fd9305f846ed3f13157b35d8f
Parents: dd837a5
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Mon Mar 14 18:30:53 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:15 2016 +0100
----------------------------------------------------------------------
wicket-experimental/pom.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/bb94964c/wicket-experimental/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/pom.xml b/wicket-experimental/pom.xml
index 9f9922d..d6aa6a0 100644
--- a/wicket-experimental/pom.xml
+++ b/wicket-experimental/pom.xml
@@ -30,6 +30,7 @@
<description>Wicket-Experimental contains experimental Wicket modules that may or may not be supported in the future.</description>
<modules>
<module>wicket-atmosphere</module>
+ <module>wicket-metrics</module>
</modules>
<build>
<pluginManagement>
[14/17] wicket git commit: Wicket Metrics - Added missing license
headers
Posted by ts...@apache.org.
Wicket Metrics - Added missing license headers
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/dd837a5f
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/dd837a5f
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/dd837a5f
Branch: refs/heads/master
Commit: dd837a5f6b6823ddf2433edd1ee09b3df67a5d10
Parents: f14b1fb
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Mon Mar 14 18:28:07 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:15 2016 +0100
----------------------------------------------------------------------
.../model/LoadableDetachableModelLoadAspect.java | 16 ++++++++++++++++
.../requesthandler/IRequestHandlerDetachAspect.java | 16 ++++++++++++++++
.../IRequestHandlerRespondAspect.java | 16 ++++++++++++++++
.../aspects/resource/IResourceCreateAspect.java | 16 ++++++++++++++++
4 files changed, 64 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/dd837a5f/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/model/LoadableDetachableModelLoadAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/model/LoadableDetachableModelLoadAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/model/LoadableDetachableModelLoadAspect.java
index 5b83de5..7d9207d 100644
--- a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/model/LoadableDetachableModelLoadAspect.java
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/model/LoadableDetachableModelLoadAspect.java
@@ -1,3 +1,19 @@
+/*
+ * 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.model;
import org.apache.wicket.metrics.WicketMetrics;
http://git-wip-us.apache.org/repos/asf/wicket/blob/dd837a5f/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerDetachAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerDetachAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerDetachAspect.java
index 7c658b4..9daa482 100644
--- a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerDetachAspect.java
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerDetachAspect.java
@@ -1,3 +1,19 @@
+/*
+ * 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.requesthandler;
import org.apache.wicket.metrics.WicketMetrics;
http://git-wip-us.apache.org/repos/asf/wicket/blob/dd837a5f/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerRespondAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerRespondAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerRespondAspect.java
index 45387f2..c953415 100644
--- a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerRespondAspect.java
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerRespondAspect.java
@@ -1,3 +1,19 @@
+/*
+ * 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.requesthandler;
import org.apache.wicket.metrics.WicketMetrics;
http://git-wip-us.apache.org/repos/asf/wicket/blob/dd837a5f/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/IResourceCreateAspect.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/IResourceCreateAspect.java b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/IResourceCreateAspect.java
index 7a5f1f7..6b15f29 100644
--- a/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/IResourceCreateAspect.java
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/IResourceCreateAspect.java
@@ -1,3 +1,19 @@
+/*
+ * 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.resource;
import org.apache.wicket.metrics.WicketMetrics;
[15/17] wicket git commit: Fixed versions for experimental modules
Posted by ts...@apache.org.
Fixed versions for experimental modules
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/5c6a846a
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/5c6a846a
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/5c6a846a
Branch: refs/heads/master
Commit: 5c6a846a5221d4bd426749eeaca8c36a84488619
Parents: bb94964
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Wed Mar 16 10:23:27 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:16 2016 +0100
----------------------------------------------------------------------
wicket-experimental/wicket-atmosphere/pom.xml | 1 +
wicket-experimental/wicket-metrics/pom.xml | 1 +
wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc | 2 +-
wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc | 3 ++-
4 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/5c6a846a/wicket-experimental/wicket-atmosphere/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-atmosphere/pom.xml b/wicket-experimental/wicket-atmosphere/pom.xml
index bca4c36..44fbf19 100644
--- a/wicket-experimental/wicket-atmosphere/pom.xml
+++ b/wicket-experimental/wicket-atmosphere/pom.xml
@@ -24,6 +24,7 @@
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>wicket-atmosphere</artifactId>
+ <version>0.24-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Wicket-Atmosphere</name>
<description>Wicket-Atmosphere provides integration of the Atmosphere Framework in Wicket.</description>
http://git-wip-us.apache.org/repos/asf/wicket/blob/5c6a846a/wicket-experimental/wicket-metrics/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/pom.xml b/wicket-experimental/wicket-metrics/pom.xml
index 3ae5827..9e81062 100644
--- a/wicket-experimental/wicket-metrics/pom.xml
+++ b/wicket-experimental/wicket-metrics/pom.xml
@@ -25,6 +25,7 @@
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>wicket-metrics</artifactId>
+ <version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Wicket Metrics</name>
<description>
http://git-wip-us.apache.org/repos/asf/wicket/blob/5c6a846a/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
index d63186d..6d41935 100644
--- a/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
@@ -5,7 +5,7 @@ This is a little example how to setup wicket-metrics within a Apache Tomcat.
<dependency>
<groupId>org.apache.wicket.experimental.wicket8</groupId>
<artifactId>wicket-metrics</artifactId>
- <version>${wicket.version}</version>
+ <version>0.X-SNAPSHOT</version>
</dependency>
{code}
http://git-wip-us.apache.org/repos/asf/wicket/blob/5c6a846a/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
index e404345..0bd18b2 100644
--- a/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
@@ -1,6 +1,5 @@
To visualize the metrics with Graphite a little additional configuration is required:
-
(1) Add the additional maven dependency to your project:
{code}
<dependency>
@@ -10,6 +9,8 @@ To visualize the metrics with Graphite a little additional configuration is requ
</dependency>
{code}
+* the metrics.graphite.version should be the same as the metrics version of the wicket-metrics dependency. Check the maven dependencies to ensure this.
+
(2) Add the following code to your Application's init method:
{code}
private GraphiteReporter reporter;
[08/17] wicket git commit: Wicket Metrics - Screenshot / further
guide improvements
Posted by ts...@apache.org.
Wicket Metrics - Screenshot / further guide improvements
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/4c0c2d5d
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/4c0c2d5d
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/4c0c2d5d
Branch: refs/heads/master
Commit: 4c0c2d5d5b40bacfb4e9f169015b92953a8e3ef3
Parents: d417c01
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Sat Mar 12 09:05:28 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:12 2016 +0100
----------------------------------------------------------------------
.../src/docs/guide/monitoring/monitoring_2.gdoc | 6 +++++-
.../src/docs/guide/monitoring/monitoring_3.gdoc | 18 ++++++++++++++++++
wicket-user-guide/src/docs/guide/toc.yml | 1 +
.../src/docs/img/wicket_metrics_graphite.png | Bin 0 -> 97808 bytes
4 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/4c0c2d5d/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
index 4ecf64e..b77e799 100644
--- a/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
@@ -63,4 +63,8 @@ reporter.start(1, TimeUnit.SECONDS);
- (20) Go to http://localhost:8080
-(4) Now start your tomcat server configured like mentioned in the previous chapter.
\ No newline at end of file
+* (18) and (19) have to be executed if the mac has been restarted
+
+(4) Now start your tomcat server configured like mentioned in the previous chapter.
+
+!wicket_metrics_graphite.png!
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/4c0c2d5d/wicket-user-guide/src/docs/guide/monitoring/monitoring_3.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_3.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_3.gdoc
new file mode 100644
index 0000000..6760b6f
--- /dev/null
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_3.gdoc
@@ -0,0 +1,18 @@
+The data which is going to be measured depends on the wicket-metrics implementation. So it doesn't make any sense to collect time data
+
+about setRepsonsePage, but it does for the constructor of components, to see if a component needs a long time to be created. You can
+
+get the information about which data has been collected from out of the mbeans.
+
+Here are some information about them:
+
+* max - the maximal time for a task (created, initialized, etc.)
+
+* min - the minimal time for a task (created, initialized, etc.)
+
+* count - how often something happend (request count)
+
+The structure is separated in the way that under core there are the kind of components measured and below that the type of operation
+
+(created, initialized, detached). In this category every component is listed dynamically.
+
http://git-wip-us.apache.org/repos/asf/wicket/blob/4c0c2d5d/wicket-user-guide/src/docs/guide/toc.yml
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/toc.yml b/wicket-user-guide/src/docs/guide/toc.yml
index f9be35e..dab016e 100644
--- a/wicket-user-guide/src/docs/guide/toc.yml
+++ b/wicket-user-guide/src/docs/guide/toc.yml
@@ -227,6 +227,7 @@ monitoring:
title: Wicket Metrics Monitoring
monitoring_1: Example setup
monitoring_2: Visualization with Graphite
+ monitoring_3: Measured data
redirects:
title: Lost In Redirection With Apache Wicket (Appendix)
contributing:
http://git-wip-us.apache.org/repos/asf/wicket/blob/4c0c2d5d/wicket-user-guide/src/docs/img/wicket_metrics_graphite.png
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/img/wicket_metrics_graphite.png b/wicket-user-guide/src/docs/img/wicket_metrics_graphite.png
new file mode 100644
index 0000000..c10ab42
Binary files /dev/null and b/wicket-user-guide/src/docs/img/wicket_metrics_graphite.png differ
[10/17] wicket git commit: Wicket Metrics - Updated API due to review
Posted by ts...@apache.org.
Wicket Metrics - Updated API due to review
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/25b1c9ea
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/25b1c9ea
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/25b1c9ea
Branch: refs/heads/master
Commit: 25b1c9eab19e9663d3fc737238b3272258029461
Parents: 4c0c2d5
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Sun Mar 13 22:35:30 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:13 2016 +0100
----------------------------------------------------------------------
wicket-metrics/pom.xml | 4 +
.../apache/wicket/metrics/WicketMetrics.java | 113 +++++++++++--------
.../wicket/metrics/WicketMetricsSettings.java | 87 ++++++++++++++
.../src/main/resources/META-INF/aop.xml | 13 ---
.../src/docs/guide/monitoring/monitoring_1.gdoc | 37 +++++-
.../src/docs/guide/monitoring/monitoring_2.gdoc | 3 +-
.../src/docs/guide/monitoring/monitoring_3.gdoc | 2 +-
7 files changed, 195 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/25b1c9ea/wicket-metrics/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-metrics/pom.xml b/wicket-metrics/pom.xml
index 4ed79f1..a3a6a5b 100644
--- a/wicket-metrics/pom.xml
+++ b/wicket-metrics/pom.xml
@@ -33,6 +33,10 @@
</description>
<dependencies>
<dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<scope>provided</scope>
http://git-wip-us.apache.org/repos/asf/wicket/blob/25b1c9ea/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
index 52ca261..6331a78 100644
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
@@ -16,9 +16,10 @@
*/
package org.apache.wicket.metrics;
+import org.apache.wicket.Application;
+import org.apache.wicket.MetaDataKey;
import org.aspectj.lang.ProceedingJoinPoint;
-import com.codahale.metrics.JmxReporter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer.Context;
@@ -31,24 +32,32 @@ import com.codahale.metrics.Timer.Context;
public class WicketMetrics
{
- private static MetricRegistry metricRegistry;
-
- private static boolean enabled = true;
-
- private static final String PREFIX = "ApacheWicket/";
-
+ /** The key for metrics **/
+ public static final MetaDataKey<WicketMetrics> METRICS = new MetaDataKey<WicketMetrics>()
+ {
+ private static final long serialVersionUID = 1L;
+ };
+
+ /** The key for metrics registry **/
+ public static final MetaDataKey<MetricRegistry> METRIC_REGISTRY = new MetaDataKey<MetricRegistry>()
+ {
+ private static final long serialVersionUID = 1L;
+ };
+
+ /** The key for metrics registry **/
+ public static final MetaDataKey<WicketMetricsSettings> METRIC_SETTINGS = new MetaDataKey<WicketMetricsSettings>()
+ {
+ private static final long serialVersionUID = 1L;
+ };
+
/**
- * Gets the metric registry
- *
- * @return the metric registry
+ * Creates the wicket metrics
*/
- public static MetricRegistry getMetricRegistry()
+ public WicketMetrics()
{
- if (metricRegistry == null)
- {
- metricRegistry = new MetricRegistry();
- }
- return metricRegistry;
+ Application application = Application.get();
+ application.setMetaData(METRICS, this);
+ application.setMetaData(METRIC_SETTINGS, new WicketMetricsSettings());
}
/**
@@ -64,10 +73,13 @@ public class WicketMetrics
*/
public Object measureTime(String name, ProceedingJoinPoint joinPoint) throws Throwable
{
- if (WicketMetrics.enabled)
+ WicketMetricsSettings settings = getSettings();
+ MetricRegistry registry = getMetricRegistry();
+
+ if (settings.isEnabled())
{
- Context context = getMetricRegistry().timer(PREFIX + name + renderClassName(joinPoint))
- .time();
+ Context context = registry
+ .timer(settings.getPrefix() + name + renderClassName(joinPoint)).time();
try
{
return joinPoint.proceed();
@@ -95,9 +107,12 @@ public class WicketMetrics
*/
public Object mark(String name, ProceedingJoinPoint joinPoint) throws Throwable
{
- if (WicketMetrics.enabled)
+ WicketMetricsSettings settings = getSettings();
+ MetricRegistry registry = getMetricRegistry();
+
+ if (settings.isEnabled())
{
- getMetricRegistry().meter(PREFIX + name + renderClassName(joinPoint)).mark();
+ registry.meter(settings.getPrefix() + name + renderClassName(joinPoint)).mark();
}
if (joinPoint != null)
{
@@ -107,7 +122,7 @@ public class WicketMetrics
}
/**
- * Stops the contex quietly
+ * Stops the context quietly
*
* @param context
* the context to stop
@@ -121,42 +136,50 @@ public class WicketMetrics
}
/**
- * Starts the jmx reporter
- */
- public static void startJmxReporter()
- {
- JmxReporter.forRegistry(getMetricRegistry()).build().start();
- }
-
- /**
- * Stops the jmx reporter
+ * Renders the class name of the given join point
+ *
+ * @param joinPoint
+ * the join point to get the class of
+ * @return the class name representation
*/
- public static void stopJmxReporter()
+ public String renderClassName(ProceedingJoinPoint joinPoint)
{
- JmxReporter.forRegistry(getMetricRegistry()).build().stop();
+ return joinPoint != null
+ ? "/" + joinPoint.getTarget().getClass().getName().replace('.', '_') : "";
}
/**
- * If the metrics should be enabled
+ * Gets the metric registry
*
- * @param enabled
- * if the metrics should be enabled
+ * @return the metric registry
*/
- public static void setEnabled(boolean enabled)
+ private MetricRegistry getMetricRegistry()
{
- WicketMetrics.enabled = enabled;
+ Application application = Application.get();
+ MetricRegistry metricRegistry = application.getMetaData(METRIC_REGISTRY);
+ if (metricRegistry == null)
+ {
+ metricRegistry = new MetricRegistry();
+ application.setMetaData(METRIC_REGISTRY, metricRegistry);
+ }
+ return metricRegistry;
}
/**
- * Renders the class name of the given join point
+ * Gets the wicket metrics settings
*
- * @param joinPoint
- * the join point to get the class of
- * @return the class name representation
+ * @return the wicket metrics settings
*/
- public String renderClassName(ProceedingJoinPoint joinPoint)
+ private WicketMetricsSettings getSettings()
{
- return joinPoint != null
- ? "/" + joinPoint.getTarget().getClass().getName().replace('.', '_') : "";
+ Application application = Application.get();
+
+ WicketMetricsSettings metricRegistry = application.getMetaData(METRIC_SETTINGS);
+ if (metricRegistry == null)
+ {
+ metricRegistry = new WicketMetricsSettings();
+ Application.get().setMetaData(METRIC_SETTINGS, metricRegistry);
+ }
+ return metricRegistry;
}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/25b1c9ea/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java
new file mode 100644
index 0000000..1bbaef2
--- /dev/null
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetricsSettings.java
@@ -0,0 +1,87 @@
+/*
+ * 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;
+
+import org.apache.wicket.Application;
+
+import com.codahale.metrics.JmxReporter;
+import com.codahale.metrics.MetricRegistry;
+
+/**
+ * Settings to configure wicket metrics
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+public class WicketMetricsSettings
+{
+
+ private boolean enabled = true;
+
+ private String prefix = "ApacheWicket/";
+
+ /**
+ * If the metrics should be enabled
+ *
+ * @param enabled
+ * if the metrics should be enabled
+ */
+ public void setEnabled(boolean enabled)
+ {
+ this.enabled = enabled;
+ }
+
+ /**
+ * If the wicket metrics are enabled
+ *
+ * @return if the wicket metrics are enabled
+ */
+ public boolean isEnabled()
+ {
+ return enabled;
+ }
+
+ /**
+ * Gets the prefix.
+ *
+ * @return the prefix
+ */
+ public String getPrefix()
+ {
+ return prefix;
+ }
+
+ /**
+ * Starts the jmx reporter
+ */
+ public void startJmxReporter()
+ {
+ MetricRegistry metricRegistry = Application.get()
+ .getMetaData(WicketMetrics.METRIC_REGISTRY);
+ JmxReporter.forRegistry(metricRegistry).build().start();
+ }
+
+ /**
+ * Stops the jmx reporter
+ */
+ public void stopJmxReporter()
+ {
+ MetricRegistry metricRegistry = Application.get()
+ .getMetaData(WicketMetrics.METRIC_REGISTRY);
+ JmxReporter.forRegistry(metricRegistry).build().stop();
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/25b1c9ea/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
deleted file mode 100644
index 0d8ee24..0000000
--- a/wicket-metrics/src/main/resources/META-INF/aop.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
-<aspectj>
- <weaver options="-nowarn">
- <include within="org.apache.wicket..*"/>
- </weaver>
- <aspects>
- <aspect name="org.apache.wicket.metrics.aspects.BehaviorAspect" />
- <aspect name="org.apache.wicket.metrics.aspects.IPartialPageRequestHandlerAspect" />
- <aspect name="org.apache.wicket.metrics.aspects.ComponentAspect" />
- <aspect name="org.apache.wicket.metrics.aspects.WicketFilterAspect" />
- <aspect name="org.apache.wicket.metrics.aspects.ResourceReferenceAspect" />
- </aspects>
-</aspectj>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/25b1c9ea/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
index 608b9c2..6d2dab5 100644
--- a/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
@@ -1,4 +1,4 @@
-This is a little example how to setup wicket-metrics within a tomcat.
+This is a little example how to setup wicket-metrics within a Apache Tomcat.
(1) Add the maven dependency to your project
{code}
@@ -13,7 +13,36 @@ This is a little example how to setup wicket-metrics within a tomcat.
(3) Add the java agent to the jvm start options of your tomcat: -javaagent:/pathToServer/lib/aspectjweaver-x.x.x.jar
-(4) To enable the JMX measurement write the following line into your init method of your Application (Now you are able to connect with jvisualvm to your server and have a look at the data):
+(4) Add an aop.xml to your project with the metrics you want to use (aspect tags) - if you don't want to enable a metrics just remove the aspect tag:
{code}
-WicketMetrics.startJmxReporter();
-{code}
\ No newline at end of file
+<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
+<aspectj>
+ <weaver options="-nowarn">
+ <include within="org.apache.wicket..*"/>
+ </weaver>
+ <aspects>
+ <aspect name="org.apache.wicket.metrics.aspects.BehaviorAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.IPartialPageRequestHandlerAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.ComponentAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.WicketFilterAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.ResourceReferenceAspect" />
+ </aspects>
+</aspectj>
+{code}
+
+(5 - optional) To enable the JMX measurement write the following line into your init method of your Application (Now you are able to connect with jvisualvm to your server and have a look at the data):
+{code}
+Application.get().getMetaData(WicketMetrics.METRIC_SETTINGS).startJmxReporter();
+{code}
+
+To deactivate:
+{code}
+Application.get().getMetaData(WicketMetrics.METRIC_SETTINGS).stopJmxReporter();
+{code}
+
+To disable measurement:
+{code}
+Application.get().getMetaData(WicketMetrics.METRIC_SETTINGS).setEnable(false);
+{code}
+
+
http://git-wip-us.apache.org/repos/asf/wicket/blob/25b1c9ea/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
index b77e799..be330ce 100644
--- a/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
@@ -11,8 +11,9 @@ To visualize the metrics with Graphite a little additional configuration is requ
(2) Add the following code to your Application's init method:
{code}
+MetricRegistry metricRegistry = Application.get().getMetaData(WicketMetrics.METRIC_REGISTRY)
final Graphite graphite = new Graphite(new InetSocketAddress("127.0.0.1", 2003));
-final GraphiteReporter reporter = GraphiteReporter.forRegistry(WicketMetrics.getMetricRegistry())
+final GraphiteReporter reporter = GraphiteReporter.forRegistry(metricRegistry)
.prefixedWith("WebApplications")
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
http://git-wip-us.apache.org/repos/asf/wicket/blob/25b1c9ea/wicket-user-guide/src/docs/guide/monitoring/monitoring_3.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_3.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_3.gdoc
index 6760b6f..56fcd89 100644
--- a/wicket-user-guide/src/docs/guide/monitoring/monitoring_3.gdoc
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_3.gdoc
@@ -1,6 +1,6 @@
The data which is going to be measured depends on the wicket-metrics implementation. So it doesn't make any sense to collect time data
-about setRepsonsePage, but it does for the constructor of components, to see if a component needs a long time to be created. You can
+about setResponsePage, but it does for the constructor of components, to see if a component needs a long time to be created. You can
get the information about which data has been collected from out of the mbeans.
[17/17] wicket git commit: Wicket Metrics - Removed unwanted include
Posted by ts...@apache.org.
Wicket Metrics - Removed unwanted include
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/07797740
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/07797740
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/07797740
Branch: refs/heads/master
Commit: 07797740c3c5f3a3728bf1a4b37a583b47c2daa9
Parents: b0219a7
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Wed Mar 16 17:48:37 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:17 2016 +0100
----------------------------------------------------------------------
.../wicket-metrics/src/main/resources/wicket-metrics.template.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/07797740/wicket-experimental/wicket-metrics/src/main/resources/wicket-metrics.template.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/resources/wicket-metrics.template.xml b/wicket-experimental/wicket-metrics/src/main/resources/wicket-metrics.template.xml
index e59cb51..377e451 100644
--- a/wicket-experimental/wicket-metrics/src/main/resources/wicket-metrics.template.xml
+++ b/wicket-experimental/wicket-metrics/src/main/resources/wicket-metrics.template.xml
@@ -1,8 +1,8 @@
+
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
<weaver options="-nowarn">
<include within="org.apache.wicket..*"/>
- <include within="com.fluentsqaure..*"/>
</weaver>
<aspects>
<aspect name="org.apache.wicket.metrics.aspects.model.LoadableDetachableModelLoadAspect" />
[04/17] wicket git commit: Wicket Metrics - Simplified time
measurement
Posted by ts...@apache.org.
Wicket Metrics - Simplified time measurement
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/c4ac72e5
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/c4ac72e5
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/c4ac72e5
Branch: refs/heads/master
Commit: c4ac72e5eb1861f5249448a8e10414e9ed8cfc2d
Parents: 5f8b9fe
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Thu Mar 10 14:12:21 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:10 2016 +0100
----------------------------------------------------------------------
.../apache/wicket/metrics/WicketMetrics.java | 30 ++++++++++++++++++--
.../metrics/aspects/ApplicationAspect.java | 12 +-------
2 files changed, 29 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/c4ac72e5/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
index 055b07f..9c4eb59 100644
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
@@ -16,6 +16,8 @@
*/
package org.apache.wicket.metrics;
+import org.aspectj.lang.ProceedingJoinPoint;
+
import com.codahale.metrics.JmxReporter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer.Context;
@@ -56,7 +58,7 @@ public class WicketMetrics
* @param name
* the name of the meter to be marked
*/
- protected void mark(String name)
+ public void mark(String name)
{
if (WicketMetrics.enabled)
{
@@ -71,7 +73,7 @@ public class WicketMetrics
* the name of the timer context
* @return the timer context
*/
- protected Context context(String name)
+ public Context context(String name)
{
if (WicketMetrics.enabled)
{
@@ -98,6 +100,30 @@ public class WicketMetrics
}
/**
+ * Simply measure the time for a {@literal @}around
+ *
+ * @param name
+ * the name of the timer context
+ * @param joinPoint
+ * the joinPoint to be proceed
+ * @return the value of the join point
+ * @throws Throwable
+ * if there is an exception while execution
+ */
+ public Object measureTime(String name, ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ Context context = context(name);
+ try
+ {
+ return joinPoint.proceed();
+ }
+ finally
+ {
+ stopQuietly(context);
+ }
+ }
+
+ /**
* Starts the jmx reporter
*/
public static void startJmxReporter()
http://git-wip-us.apache.org/repos/asf/wicket/blob/c4ac72e5/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 10d51a8..45fe51d 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
@@ -21,8 +21,6 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
-import com.codahale.metrics.Timer.Context;
-
/**
* Aspect to handle basic web application information
*
@@ -46,14 +44,6 @@ public class ApplicationAspect extends WicketMetrics
@Around("execution(* org.apache.wicket.protocol.http.WicketFilter.processRequest(..))")
public Object aroundRequestProcessed(ProceedingJoinPoint joinPoint) throws Throwable
{
- Context context = context("core/application/request");
- try
- {
- return joinPoint.proceed();
- }
- finally
- {
- stopQuietly(context);
- }
+ return measureTime("core/application/request", joinPoint);
}
}
[07/17] wicket git commit: Wicket Metrics - Guide / Added several new
measurement aspects
Posted by ts...@apache.org.
Wicket Metrics - Guide / Added several new measurement aspects
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d417c01f
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d417c01f
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d417c01f
Branch: refs/heads/master
Commit: d417c01f94cf778d040e355d14f2e81717631777
Parents: 58c9fcb
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Fri Mar 11 19:29:30 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:12 2016 +0100
----------------------------------------------------------------------
.../apache/wicket/metrics/WicketMetrics.java | 82 +++++++++++---------
.../metrics/aspects/ApplicationAspect.java | 49 ------------
.../wicket/metrics/aspects/BehaviorAspect.java | 47 +++++++++++
.../wicket/metrics/aspects/ComponentAspect.java | 72 ++++++++++++++---
.../IPartialPageRequestHandlerAspect.java | 68 ++++++++++++++++
.../aspects/ResourceReferenceAspect.java | 11 ++-
.../metrics/aspects/WicketFilterAspect.java | 49 ++++++++++++
.../src/main/resources/META-INF/aop.xml | 4 +-
.../src/docs/guide/monitoring.gdoc | 7 ++
.../src/docs/guide/monitoring/monitoring_1.gdoc | 19 +++++
.../src/docs/guide/monitoring/monitoring_2.gdoc | 66 ++++++++++++++++
wicket-user-guide/src/docs/guide/toc.yml | 4 +
12 files changed, 375 insertions(+), 103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
index 9c4eb59..52ca261 100644
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
@@ -51,38 +51,59 @@ public class WicketMetrics
return metricRegistry;
}
-
/**
- * Marks the meter with the given name
+ * Simply measure the time for a {@literal @}around
*
* @param name
- * the name of the meter to be marked
+ * the name of the timer context
+ * @param joinPoint
+ * the joinPoint to be proceed
+ * @return the value of the join point
+ * @throws Throwable
+ * if there is an exception while execution
*/
- public void mark(String name)
+ public Object measureTime(String name, ProceedingJoinPoint joinPoint) throws Throwable
{
if (WicketMetrics.enabled)
{
- getMetricRegistry().meter(PREFIX + name).mark();
+ Context context = getMetricRegistry().timer(PREFIX + name + renderClassName(joinPoint))
+ .time();
+ try
+ {
+ return joinPoint.proceed();
+ }
+ finally
+ {
+ stopQuietly(context);
+ }
+ }
+ else
+ {
+ return joinPoint.proceed();
}
}
/**
- * Gets a timer context
+ * Marks the meter with the given name
*
* @param name
- * the name of the timer context
- * @return the timer context
+ * the name of the meter to be marked
+ * @param joinPoint
+ * the join point
+ * @return the result of the proceeded join point
+ * @throws Throwable
*/
- public Context context(String name)
+ public Object mark(String name, ProceedingJoinPoint joinPoint) throws Throwable
{
if (WicketMetrics.enabled)
{
- return getMetricRegistry().timer(PREFIX + name).time();
+ getMetricRegistry().meter(PREFIX + name + renderClassName(joinPoint)).mark();
}
- else
+ if (joinPoint != null)
{
- return null;
+ return joinPoint.proceed();
}
+ return null;
}
/**
@@ -100,30 +121,6 @@ public class WicketMetrics
}
/**
- * Simply measure the time for a {@literal @}around
- *
- * @param name
- * the name of the timer context
- * @param joinPoint
- * the joinPoint to be proceed
- * @return the value of the join point
- * @throws Throwable
- * if there is an exception while execution
- */
- public Object measureTime(String name, ProceedingJoinPoint joinPoint) throws Throwable
- {
- Context context = context(name);
- try
- {
- return joinPoint.proceed();
- }
- finally
- {
- stopQuietly(context);
- }
- }
-
- /**
* Starts the jmx reporter
*/
public static void startJmxReporter()
@@ -149,4 +146,17 @@ public class WicketMetrics
{
WicketMetrics.enabled = enabled;
}
+
+ /**
+ * Renders the class name of the given join point
+ *
+ * @param joinPoint
+ * the join point to get the class of
+ * @return the class name representation
+ */
+ public String renderClassName(ProceedingJoinPoint joinPoint)
+ {
+ return joinPoint != null
+ ? "/" + joinPoint.getTarget().getClass().getName().replace('.', '_') : "";
+ }
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/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
deleted file mode 100644
index a2ee0dd..0000000
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/ApplicationAspect.java
+++ /dev/null
@@ -1,49 +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.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-
-/**
- * Aspect to handle basic web application information
- *
- * @author Tobias Soloschenko
- */
-@Aspect
-public class ApplicationAspect extends WicketMetrics
-{
-
- /**
- * Collects data how often a request has been made against the webapp and counts the time how
- * long the request remains
- *
- * @param joinPoint
- * the joinPoint to be proceed
- * @return returns the boolean of the processRequest method
- *
- * @throws Throwable
- * might occur while invoking process request
- */
- @Around("execution(* org.apache.wicket.protocol.http.WicketFilter.processRequest(..))")
- public Object aroundRequestProcessed(ProceedingJoinPoint joinPoint) throws Throwable
- {
- return measureTime("core/application/request", joinPoint);
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/BehaviorAspect.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/BehaviorAspect.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/BehaviorAspect.java
new file mode 100644
index 0000000..94cc60c
--- /dev/null
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/BehaviorAspect.java
@@ -0,0 +1,47 @@
+/*
+ * 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;
+
+/**
+ * Measures everything about behaviors
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class BehaviorAspect extends WicketMetrics
+{
+ /**
+ * Collects data how often a behavior is created
+ *
+ * @param joinPoint
+ * the join point (behavior) which is created
+ * @return the result of constructor
+ * @throws Throwable
+ * might occur while creating a new behavior
+ */
+ @Around("execution(org.apache.wicket.behavior.Behavior.new(..))")
+ public Object aroundNew(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return mark("core/behavior/create", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/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
index 65df92b..e046a63 100644
--- 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
@@ -35,14 +35,15 @@ public class ComponentAspect extends WicketMetrics
* Collects data how often components are rendered
*
* @param joinPoint
- * @return the object returned from the joinPoint
+ * the join point (component) which is rendered
+ * @return the object returned from the join point
* @throws Throwable
+ * might occur while onRender
*/
- @Around("target(org.apache.wicket.Component+) && execution(* onRender(..))")
- public Object aroundRender(ProceedingJoinPoint joinPoint) throws Throwable
+ @Around("execution(* org.apache.wicket.Component.onRender(..))")
+ public Object aroundOnRender(ProceedingJoinPoint joinPoint) throws Throwable
{
- return measureTime("core/component/render/" + joinPoint.getTarget().getClass().getName(),
- joinPoint);
+ return measureTime("core/component/render", joinPoint);
}
/**
@@ -50,23 +51,72 @@ public class ComponentAspect extends WicketMetrics
*
* @param joinPoint
* the join point (component) which is created
- * @return the object returned from the joinPoint
+ * @return the object returned from the join point
* @throws Throwable
- * might occur while invoking process request
+ * might occur while constructing a new component
*/
@Around("execution(org.apache.wicket.Component.new(..))")
public Object aroundNew(ProceedingJoinPoint joinPoint) throws Throwable
{
- return measureTime("core/component/create/" + joinPoint.getTarget().getClass().getName(),
- joinPoint);
+ return measureTime("core/component/create", joinPoint);
+ }
+
+ /**
+ * Collects data how often components calls onConfigure
+ *
+ * @param joinPoint
+ * the join point (component) which is configured
+ * @return the object returned from the join point
+ *
+ * @throws Throwable
+ * might occur while invoking onConfigure
+ */
+ @Around("execution(* org.apache.wicket.Component.onConfigure(..))")
+ public Object aroundOnConfigure(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/component/configure", joinPoint);
+ }
+
+ /**
+ * Collects data how often components calls onInitialize
+ *
+ * @param joinPoint
+ * the join point (component) which is initialized
+ * @return the object returned from the join point
+ *
+ * @throws Throwable
+ * might occur while invoking onInitialize
+ */
+ @Around("execution(* org.apache.wicket.Component.onInitialize(..))")
+ public Object aroundOnInitialize(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/component/initialize", joinPoint);
+ }
+
+ /**
+ * Collects data how often components calls onDetach
+ *
+ * @param joinPoint
+ * the join point (component) which is calling detach
+ * @return the object returned from the join point
+ * @throws Throwable
+ * might occur while invoking onDetach
+ */
+ @Around("execution(* org.apache.wicket.Component.onDetach(..))")
+ public Object arroundOnDetach(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return mark("core/component/detach", joinPoint);
}
/**
* Collects data how often components redirect to another page
+ *
+ * @throws Throwable
+ * might occur while invoking setResponsePage
*/
@Before("call(* org.apache.wicket.Component.setResponsePage(..))")
- public void aroundResponsePage()
+ public void beforeResponsePage() throws Throwable
{
- mark("core/component/redirect");
+ mark("core/component/redirect", null);
}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/IPartialPageRequestHandlerAspect.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/IPartialPageRequestHandlerAspect.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/IPartialPageRequestHandlerAspect.java
new file mode 100644
index 0000000..24cb2a1
--- /dev/null
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/IPartialPageRequestHandlerAspect.java
@@ -0,0 +1,68 @@
+/*
+ * 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;
+
+/**
+ * Aspect which checks ajax request targets
+ *
+ * @author Tobias Soloschenko
+ *
+ */
+@Aspect
+public class IPartialPageRequestHandlerAspect extends WicketMetrics
+{
+ /**
+ * Collects data how often components calls add
+ *
+ * @throws Throwable
+ * might occur while invoking add
+ */
+ @Before("call(* org.apache.wicket.core.request.handler.IPartialPageRequestHandler.add(..))")
+ public void beforeAdd() throws Throwable
+ {
+ mark("core/ajax/add", null);
+ }
+
+ /**
+ * Collects data how often components calls prependJavaScript
+ *
+ * @throws Throwable
+ * might occur while invoking prependJavaScript
+ */
+ @Before("call(* org.apache.wicket.core.request.handler.IPartialPageRequestHandler.prependJavaScript(..))")
+ public void beforePrependJavaScript() throws Throwable
+ {
+ mark("core/ajax/prependJavaScript", null);
+ }
+
+ /**
+ * Collects data how often components calls appendJavaScript
+ *
+ * @throws Throwable
+ * might occur while invoking appendJavaScript
+ */
+ @Before("call(* org.apache.wicket.core.request.handler.IPartialPageRequestHandler.appendJavaScript(..))")
+ public void beforeAppendJavaScript() throws Throwable
+ {
+ mark("core/ajax/appendJavaScript", null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/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
index 1430ee7..cd11e54 100644
--- 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
@@ -32,18 +32,17 @@ public class ResourceReferenceAspect extends WicketMetrics
{
/**
- * Collects data how often components are created
+ * Collects data how often a resource reference is created
*
* @param joinPoint
- * the join point (component) which is created
- * @return the object returned from the joinPoint
+ * the join point (resource reference) which is created
+ * @return the result of constructor
* @throws Throwable
- * might occur while invoking process request
+ * might occur while creating a new resource reference
*/
@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();
+ return mark("core/resource/create", joinPoint);
}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java
new file mode 100644
index 0000000..bb31b74
--- /dev/null
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.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;
+
+/**
+ * Aspect to handle basic web application information
+ *
+ * @author Tobias Soloschenko
+ */
+@Aspect
+public class WicketFilterAspect extends WicketMetrics
+{
+
+ /**
+ * Collects data how often a request has been made against the webapp and counts the time how
+ * long the request remains
+ *
+ * @param joinPoint
+ * the joinPoint to be proceed
+ * @return returns the boolean of the processRequest method
+ *
+ * @throws Throwable
+ * might occur while invoking process request
+ */
+ @Around("execution(* org.apache.wicket.protocol.http.WicketFilter.processRequest(..))")
+ public Object aroundRequestProcessed(ProceedingJoinPoint joinPoint) throws Throwable
+ {
+ return measureTime("core/application/request", joinPoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/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 eedd397..0d8ee24 100644
--- a/wicket-metrics/src/main/resources/META-INF/aop.xml
+++ b/wicket-metrics/src/main/resources/META-INF/aop.xml
@@ -4,8 +4,10 @@
<include within="org.apache.wicket..*"/>
</weaver>
<aspects>
+ <aspect name="org.apache.wicket.metrics.aspects.BehaviorAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.IPartialPageRequestHandlerAspect" />
<aspect name="org.apache.wicket.metrics.aspects.ComponentAspect" />
- <aspect name="org.apache.wicket.metrics.aspects.ApplicationAspect" />
+ <aspect name="org.apache.wicket.metrics.aspects.WicketFilterAspect" />
<aspect name="org.apache.wicket.metrics.aspects.ResourceReferenceAspect" />
</aspects>
</aspectj>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/wicket-user-guide/src/docs/guide/monitoring.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring.gdoc b/wicket-user-guide/src/docs/guide/monitoring.gdoc
new file mode 100644
index 0000000..413f510
--- /dev/null
+++ b/wicket-user-guide/src/docs/guide/monitoring.gdoc
@@ -0,0 +1,7 @@
+The wicket-metrics module is available since Wicket 8.0.0 and contains a life measurement implementation to collect data of applications and visualize it.
+
+You can see how many request your application served, how often components are created, initalized, configured or their detach method has been invoked and a lot of other additional information.
+
+The module itself is using "Metrics of dropwizard":https://dropwizard.github.io/metrics/3.1.0/ and "AspectJ":https://eclipse.org/aspectj/ so that if you turn of the measurement it has no longer any effect
+
+to your web application.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
new file mode 100644
index 0000000..608b9c2
--- /dev/null
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
@@ -0,0 +1,19 @@
+This is a little example how to setup wicket-metrics within a tomcat.
+
+(1) Add the maven dependency to your project
+{code}
+<dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-metrics</artifactId>
+ <version>${wicket.version}</version>
+</dependency>
+{code}
+
+(2) Just drop the jars of aspectjrt and aspectjweaver into the tomcat lib folder - you can download it from here "http://mvnrepository.com/artifact/org.aspectj/":http://mvnrepository.com/artifact/org.aspectj/ (the metrics dependency is shipped with the project)
+
+(3) Add the java agent to the jvm start options of your tomcat: -javaagent:/pathToServer/lib/aspectjweaver-x.x.x.jar
+
+(4) To enable the JMX measurement write the following line into your init method of your Application (Now you are able to connect with jvisualvm to your server and have a look at the data):
+{code}
+WicketMetrics.startJmxReporter();
+{code}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
new file mode 100644
index 0000000..4ecf64e
--- /dev/null
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
@@ -0,0 +1,66 @@
+To visualize the metrics with Graphite a little additional configuration is required:
+
+(1) Add the additional maven dependency to your project:
+{code}
+<dependency>
+ <groupId>io.dropwizard.metrics</groupId>
+ <artifactId>metrics-graphite</artifactId>
+ <version>${metrics.graphite.version}</version>
+</dependency>
+{code}
+
+(2) Add the following code to your Application's init method:
+{code}
+final Graphite graphite = new Graphite(new InetSocketAddress("127.0.0.1", 2003));
+final GraphiteReporter reporter = GraphiteReporter.forRegistry(WicketMetrics.getMetricRegistry())
+ .prefixedWith("WebApplications")
+ .convertRatesTo(TimeUnit.SECONDS)
+ .convertDurationsTo(TimeUnit.MILLISECONDS)
+ .filter(MetricFilter.ALL)
+ .build(graphite);
+reporter.start(1, TimeUnit.SECONDS);
+{code}
+
+(3) Install and setup graphite on your system. Example installation for mac (beware that this is only a quickstart setup!):
+
+- (1) Install homebrew: "brew":http://brew.sh/
+
+- (2) Install "Git":https://git-scm.com/
+
+- (3) brew install python
+
+- (4) brew install cairo
+
+- (5) brew install py2cairo
+
+- (6) pip install Django==1.5
+
+- (7) pip install "django-tagging<0.4"
+
+- (8) sudo pip install carbon
+
+- (9) pip install whisper
+
+- (10) sudo pip install graphite-web
+
+- (11) sudo pip install Twisted==11.1.0
+
+- (12) sudo chown -R <your username>:staff /opt/graphite
+
+- (13) cp /opt/graphite/conf/carbon.conf{.example,}
+
+- (14) cp /opt/graphite/conf/storage-schemas.conf{.example,}
+
+- (15) cd /opt/graphite/webapp/graphite
+
+- (16) cp local_settings.py{.example,}
+
+- (17) python manage.py syncdb
+
+- (18) python /opt/graphite/bin/carbon-cache.py start
+
+- (19) python /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite
+
+- (20) Go to http://localhost:8080
+
+(4) Now start your tomcat server configured like mentioned in the previous chapter.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/d417c01f/wicket-user-guide/src/docs/guide/toc.yml
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/toc.yml b/wicket-user-guide/src/docs/guide/toc.yml
index 520d57b..f9be35e 100644
--- a/wicket-user-guide/src/docs/guide/toc.yml
+++ b/wicket-user-guide/src/docs/guide/toc.yml
@@ -223,6 +223,10 @@ wicketstuff:
wicketstuff_5: Module wicketstuff-inmethod-grid
wicketstuff_6: Module wicketstuff-rest-annotations
wicketstuff_7: Module stateless
+monitoring:
+ title: Wicket Metrics Monitoring
+ monitoring_1: Example setup
+ monitoring_2: Visualization with Graphite
redirects:
title: Lost In Redirection With Apache Wicket (Appendix)
contributing:
[09/17] wicket git commit: Wicket Metrics - Fixed thread local issue
Posted by ts...@apache.org.
Wicket Metrics - Fixed thread local issue
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/f64a4803
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/f64a4803
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/f64a4803
Branch: refs/heads/master
Commit: f64a48033e6705bde690716779dabb94fa11e24a
Parents: 25b1c9e
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Mon Mar 14 08:54:55 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:13 2016 +0100
----------------------------------------------------------------------
.../apache/wicket/metrics/WicketMetrics.java | 25 ++++----------------
.../metrics/aspects/WicketFilterAspect.java | 4 ++--
2 files changed, 6 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/f64a4803/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
index 6331a78..51e55c5 100644
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
@@ -32,33 +32,17 @@ import com.codahale.metrics.Timer.Context;
public class WicketMetrics
{
- /** The key for metrics **/
- public static final MetaDataKey<WicketMetrics> METRICS = new MetaDataKey<WicketMetrics>()
- {
- private static final long serialVersionUID = 1L;
- };
-
/** The key for metrics registry **/
public static final MetaDataKey<MetricRegistry> METRIC_REGISTRY = new MetaDataKey<MetricRegistry>()
{
private static final long serialVersionUID = 1L;
};
-
+
/** The key for metrics registry **/
public static final MetaDataKey<WicketMetricsSettings> METRIC_SETTINGS = new MetaDataKey<WicketMetricsSettings>()
{
private static final long serialVersionUID = 1L;
};
-
- /**
- * Creates the wicket metrics
- */
- public WicketMetrics()
- {
- Application application = Application.get();
- application.setMetaData(METRICS, this);
- application.setMetaData(METRIC_SETTINGS, new WicketMetricsSettings());
- }
/**
* Simply measure the time for a {@literal @}around
@@ -75,7 +59,7 @@ public class WicketMetrics
{
WicketMetricsSettings settings = getSettings();
MetricRegistry registry = getMetricRegistry();
-
+
if (settings.isEnabled())
{
Context context = registry
@@ -109,7 +93,7 @@ public class WicketMetrics
{
WicketMetricsSettings settings = getSettings();
MetricRegistry registry = getMetricRegistry();
-
+
if (settings.isEnabled())
{
registry.meter(settings.getPrefix() + name + renderClassName(joinPoint)).mark();
@@ -173,12 +157,11 @@ public class WicketMetrics
private WicketMetricsSettings getSettings()
{
Application application = Application.get();
-
WicketMetricsSettings metricRegistry = application.getMetaData(METRIC_SETTINGS);
if (metricRegistry == null)
{
metricRegistry = new WicketMetricsSettings();
- Application.get().setMetaData(METRIC_SETTINGS, metricRegistry);
+ application.setMetaData(METRIC_SETTINGS, metricRegistry);
}
return metricRegistry;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/f64a4803/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java
index bb31b74..c71430c 100644
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/WicketFilterAspect.java
@@ -41,9 +41,9 @@ public class WicketFilterAspect extends WicketMetrics
* @throws Throwable
* might occur while invoking process request
*/
- @Around("execution(* org.apache.wicket.protocol.http.WicketFilter.processRequest(..))")
+ @Around("execution(* org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(..))")
public Object aroundRequestProcessed(ProceedingJoinPoint joinPoint) throws Throwable
{
- return measureTime("core/application/request", joinPoint);
+ return measureTime("core/application/requestCycle", joinPoint);
}
}
[16/17] wicket git commit: Fixed version in parent pom
Posted by ts...@apache.org.
Fixed version in parent pom
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/b0219a7a
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/b0219a7a
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/b0219a7a
Branch: refs/heads/master
Commit: b0219a7a24e681f62702dede0bc0e5728e76b396
Parents: 5c6a846
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Wed Mar 16 13:00:28 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:16 2016 +0100
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/b0219a7a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 05d565f..5254637 100644
--- a/pom.xml
+++ b/pom.xml
@@ -407,7 +407,7 @@
<dependency>
<groupId>org.apache.wicket.experimental.wicket8</groupId>
<artifactId>wicket-metrics</artifactId>
- <version>8.0.0-SNAPSHOT</version>
+ <version>0.1-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
[03/17] wicket git commit: Wicket Metrics - Time measurement /
license header
Posted by ts...@apache.org.
Wicket Metrics - Time measurement / license header
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/5f8b9fe0
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/5f8b9fe0
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/5f8b9fe0
Branch: refs/heads/master
Commit: 5f8b9fe07b6581cebb5f88a2b00e657e292dc31c
Parents: fc85c03
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Thu Mar 10 14:03:19 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Wed Mar 16 17:55:09 2016 +0100
----------------------------------------------------------------------
.../apache/wicket/metrics/WicketMetrics.java | 54 +++++++++++++++++++-
.../metrics/aspects/ApplicationAspect.java | 45 ++++++++++++++--
.../wicket/metrics/aspects/PageAspect.java | 16 ++++++
3 files changed, 108 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/5f8b9fe0/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
----------------------------------------------------------------------
diff --git a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
index 26314f0..055b07f 100644
--- a/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
+++ b/wicket-metrics/src/main/java/org/apache/wicket/metrics/WicketMetrics.java
@@ -1,7 +1,24 @@
+/*
+ * 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;
import com.codahale.metrics.JmxReporter;
import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Timer.Context;
/**
* Base aspect provides access to the metric registry
@@ -16,7 +33,7 @@ public class WicketMetrics
private static boolean enabled = true;
- private static final String JMX_PREFIX = "ApacheWicket/";
+ private static final String PREFIX = "ApacheWicket/";
/**
* Gets the metric registry
@@ -43,7 +60,40 @@ public class WicketMetrics
{
if (WicketMetrics.enabled)
{
- getMetricRegistry().meter(JMX_PREFIX + name).mark();
+ getMetricRegistry().meter(PREFIX + name).mark();
+ }
+ }
+
+ /**
+ * Gets a timer context
+ *
+ * @param name
+ * the name of the timer context
+ * @return the timer context
+ */
+ protected Context context(String name)
+ {
+ if (WicketMetrics.enabled)
+ {
+ return getMetricRegistry().timer(PREFIX + name).time();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Stops the contex quietly
+ *
+ * @param context
+ * the context to stop
+ */
+ public void stopQuietly(Context context)
+ {
+ if (context != null)
+ {
+ context.stop();
}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/5f8b9fe0/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 2f56e50..10d51a8 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
@@ -1,8 +1,27 @@
+/*
+ * 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;
+
+import com.codahale.metrics.Timer.Context;
/**
* Aspect to handle basic web application information
@@ -14,11 +33,27 @@ public class ApplicationAspect extends WicketMetrics
{
/**
- * Collects data how often a request has been made against the web app
+ * Collects data how often a request has been made against the webapp and counts the time how
+ * long the request remains
+ *
+ * @param joinPoint
+ * the joinPoint to be proceed
+ * @return returns the boolean of the processRequest method
+ *
+ * @throws Throwable
+ * might occure while invoking process request
*/
- @Before("call(* org.apache.wicket.protocol.http.WicketFilter.processRequest(..))")
- public void beforeRequestProcessed()
+ @Around("execution(* org.apache.wicket.protocol.http.WicketFilter.processRequest(..))")
+ public Object aroundRequestProcessed(ProceedingJoinPoint joinPoint) throws Throwable
{
- mark("core/application/request");
+ Context context = context("core/application/request");
+ try
+ {
+ return joinPoint.proceed();
+ }
+ finally
+ {
+ stopQuietly(context);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/5f8b9fe0/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
index 4e85a36..1f03d35 100644
--- 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
@@ -1,3 +1,19 @@
+/*
+ * 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;