http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-user-guide/src/docs/guide/monitoring/monitoring_4.gdoc ---------------------------------------------------------------------- diff --git a/wicket-user-guide/src/docs/guide/monitoring/monitoring_4.gdoc b/wicket-user-guide/src/docs/guide/monitoring/monitoring_4.gdoc new file mode 100644 index 0000000..004b26d --- /dev/null +++ b/wicket-user-guide/src/docs/guide/monitoring/monitoring_4.gdoc @@ -0,0 +1,33 @@ +There are only a two steps required to write own measurements for life data statistics in wicket: + +(1) Write a class which is named very close to what it measures. This class should extends WicketMetrics and should annotated with @Aspect and provide one method with a join point scanning for the target signature. +{code} + @Aspect + public class MySpecialAspect extends WicketMetrics + { + @Around("execution(* my.package.MyClass.myMethod(..))") + public Object aroundRequestProcessed(ProceedingJoinPoint joinPoint) throws Throwable + { + return measureTime("mycategory/someinformation/", joinPoint); + } + } +{code} +* To measure time you need @Around because measureTime of WicketMetrics requires the joinPoint - the class name is appended with a slash at the end + +* To only mark that a method is called you can use mark of WicketMetrics and apply null as a second parameter - if you apply a join point to mark the class name is appended with a slash at the end + +(2) Add the class to your aop.xml and of course the package to scan for classes that are target for your measurements: +{code} +<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"> +<aspectj> + <weaver options="-nowarn"> + <include within="org.apache.wicket..*"/> + <include within="my.package..*"/> + </weaver> + <aspects> + <aspect name="my.package.MySpecialAspect" /> + <!-- wickets own metrics --> + ..... + </aspects> +</aspectj> +{code} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/f14b1fb4/wicket-user-guide/src/docs/guide/toc.yml ---------------------------------------------------------------------- diff --git a/wicket-user-guide/src/docs/guide/toc.yml b/wicket-user-guide/src/docs/guide/toc.yml index dab016e..303903c 100644 --- a/wicket-user-guide/src/docs/guide/toc.yml +++ b/wicket-user-guide/src/docs/guide/toc.yml @@ -224,10 +224,11 @@ wicketstuff: wicketstuff_6: Module wicketstuff-rest-annotations wicketstuff_7: Module stateless monitoring: - title: Wicket Metrics Monitoring + title: Wicket Metrics Monitoring (Experimental) monitoring_1: Example setup monitoring_2: Visualization with Graphite monitoring_3: Measured data + monitoring_4: Write own measurements redirects: title: Lost In Redirection With Apache Wicket (Appendix) contributing:
