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/21 19:46:00 UTC
wicket git commit: wicket-metrics - backport to wicket-7.x
Repository: wicket
Updated Branches:
refs/heads/wicket-7.x 5dc37039b -> 7e948aedf
wicket-metrics - backport to wicket-7.x
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/7e948aed
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/7e948aed
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/7e948aed
Branch: refs/heads/wicket-7.x
Commit: 7e948aedfe462cfd3fb00a2dd0983c09b208cf80
Parents: 5dc3703
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Mon Mar 21 19:41:33 2016 +0100
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Mon Mar 21 19:43:46 2016 +0100
----------------------------------------------------------------------
NOTICE | 12 ++
README | 2 +
pom.xml | 18 ++
wicket-experimental/pom.xml | 1 +
wicket-experimental/wicket-metrics/pom.xml | 50 ++++++
.../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 | 48 ++++++
.../IRequestHandlerDetachAspect.java | 47 ++++++
.../IRequestHandlerRespondAspect.java | 47 ++++++
.../aspects/resource/IResourceCreateAspect.java | 46 +++++
.../resource/ResourceReferenceCreateAspect.java | 48 ++++++
.../src/main/resources/META-INF/NOTICE | 9 +
.../main/resources/wicket-metrics.template.xml | 26 +++
.../src/docs/guide/monitoring.gdoc | 9 +
.../src/docs/guide/monitoring/monitoring_1.gdoc | 64 +++++++
.../src/docs/guide/monitoring/monitoring_2.gdoc | 85 ++++++++++
.../src/docs/guide/monitoring/monitoring_3.gdoc | 18 ++
.../src/docs/guide/monitoring/monitoring_4.gdoc | 33 ++++
wicket-user-guide/src/docs/guide/toc.yml | 6 +
.../src/docs/img/wicket_metrics_graphite.png | Bin 0 -> 97808 bytes
33 files changed, 1374 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/7e948aed/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index 3685898..c2b4544 100644
--- a/NOTICE
+++ b/NOTICE
@@ -116,4 +116,16 @@ src/./wicket-datetime
This product includes software developed by
Joda.org (http://www.joda.org/).
+
+---------------------------------------------------------------------------
+src/./wicket-metrics
+---------------------------------------------------------------------------
+
+ Apache Wicket Metrics
+ Copyright 2006-2016 Apache Software Foundation
+
+ This product includes software developed at
+ The Apache Software Foundation (http://www.apache.org/).
+ This product uses AspectJ, developed at Eclipse, and licensed
+ under the Eclipse Public License. (https://eclipse.org/aspectj/).
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/7e948aed/README
----------------------------------------------------------------------
diff --git a/README b/README
index ea54ca8..74a44db 100644
--- a/README
+++ b/README
@@ -76,6 +76,7 @@ You will find the source code here:
|-- wicket-spring
|-- wicket-util
|-- wicket-user-guide
+ |-- wicket-metrics
`-- wicket-velocity
@@ -118,6 +119,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/7e948aed/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f8e3aa4..496056b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -142,6 +142,8 @@
<objenesis.version>2.1</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>
@@ -399,6 +401,12 @@
</dependency>
<dependency>
<groupId>org.apache.wicket.experimental.wicket7</groupId>
+ <artifactId>wicket-metrics</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wicket.experimental.wicket7</groupId>
<artifactId>wicket-atmosphere</artifactId>
<version>0.26-SNAPSHOT</version>
<type>jar</type>
@@ -531,6 +539,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/7e948aed/wicket-experimental/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/pom.xml b/wicket-experimental/pom.xml
index 2e8a4af..38944b2 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>
http://git-wip-us.apache.org/repos/asf/wicket/blob/7e948aed/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..250ed4a
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/pom.xml
@@ -0,0 +1,50 @@
+<?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.wicket7</groupId>
+ <artifactId>wicket-experimental</artifactId>
+ <version>7.3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>wicket-metrics</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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/7e948aed/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..7d9207d
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/model/LoadableDetachableModelLoadAspect.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.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/7e948aed/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..9daa482
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerDetachAspect.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.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/7e948aed/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..c953415
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/requesthandler/IRequestHandlerRespondAspect.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.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/7e948aed/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..6b15f29
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/java/org/apache/wicket/metrics/aspects/resource/IResourceCreateAspect.java
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+/**
+ * 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/7e948aed/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/7e948aed/wicket-experimental/wicket-metrics/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-metrics/src/main/resources/META-INF/NOTICE b/wicket-experimental/wicket-metrics/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000..b84348b
--- /dev/null
+++ b/wicket-experimental/wicket-metrics/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,9 @@
+ Apache Wicket Metrics
+ Copyright 2006-2016 Apache Software Foundation
+
+ This product includes software developed at
+ The Apache Software Foundation (http://www.apache.org/).
+
+ This product uses AspectJ, developed at Eclipse, and licensed
+ under the Eclipse Public License. (https://eclipse.org/aspectj/).
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/7e948aed/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..377e451
--- /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..*"/>
+ </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/7e948aed/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..28124bd
--- /dev/null
+++ b/wicket-user-guide/src/docs/guide/monitoring.gdoc
@@ -0,0 +1,9 @@
+The wicket-metrics module is available since Wicket 7.3.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.
+
+Keep in mind that AspectJ is licensed under the Eclipse Public License and should provide the required license information.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/7e948aed/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..6d41935
--- /dev/null
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_1.gdoc
@@ -0,0 +1,64 @@
+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.experimental.wicket8</groupId>
+ <artifactId>wicket-metrics</artifactId>
+ <version>0.X-SNAPSHOT</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) 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>
+ <weaver options="-nowarn">
+ <include within="org.apache.wicket..*"/>
+ </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>
+{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();
+{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/7e948aed/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..0bd18b2
--- /dev/null
+++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_2.gdoc
@@ -0,0 +1,85 @@
+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}
+
+* 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;
+
+ @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!):
+
+- (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
+
+* (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/7e948aed/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..56fcd89
--- /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 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.
+
+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/7e948aed/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/7e948aed/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..303903c 100644
--- a/wicket-user-guide/src/docs/guide/toc.yml
+++ b/wicket-user-guide/src/docs/guide/toc.yml
@@ -223,6 +223,12 @@ wicketstuff:
wicketstuff_5: Module wicketstuff-inmethod-grid
wicketstuff_6: Module wicketstuff-rest-annotations
wicketstuff_7: Module stateless
+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:
http://git-wip-us.apache.org/repos/asf/wicket/blob/7e948aed/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