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:21 UTC
[07/17] wicket git commit: Wicket Metrics - Guide / Added several new
measurement aspects
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: