Automon combines the power of AOP (AspectJ) with monitoring or logging tools you already use to declaratively monitor your Java code, the JDK, and 3rd party libraries.
Automon combines the power of AOP (AspectJ) with monitoring tools or logging tools that you already use to declaratively monitor the following:
Some monitoring tools Automon currently works with are: JAMon, JavaSimon, Yammer Metrics, StatsD, Micrometer. Here are the current implementations. If automon doesn't support your tool of intrest it can usually be supported by adding a simple class.
Note: Micrometer serves as a proxy for other monitoring/metering APIs and so through it automon does too. As of 5/2019 the list of tools Micrometer can proxy includes: AppOptics, Atlas, Datadog, Dynatrace, Elastic, Ganglia, Graphite, Humio, Influx, JMX, KairosDB, New Relic, Prometheus, SignalFx, StatsD, Wavefront.
Automon is typically used to track method invocation time, and exception counts. It is very easy to set-up and you should be able to start monitoring your code within minutes. The data will be stored and displayed using the monitoring tool of your choice. The following image shows the type of data Automon collects (The example below displays the data in JAMon, however the data can be displayed in whatever monitoring tool/api you choose. For example here is same data displayed in grahphite/StatsD).
The following is a sample command that will monitor your program with Automon (in this case using JAMon):
<pointcut name="profile" expression="within(com.stevesouza..*)"/>
See 'Getting Started' below and examples for instructions on how to run Automon with CodaHale/Yammer Metrics, JavaSimon, NewRelic, StatsD, Tomcat and Jetty.
It is important to note that Automon is complimentary to monitoring and logging tools. Automon performs no monitoring on its own. It serves as a bridge between AspectJ (AspectJ defines 'what to monitor') and monitoring and logging tools (which define 'how to monitor'). You can also easily provide your own monitoring tool by implementing the simple OpenMon interface.
The following diagram shows an AspectJ pointcut that will monitor all methods (any return type, any number of arguments) in the 'com.mycompany' package as well as its subpackages (..) using your monitoring tool of choice.
Automon requires jdk 1.5 or higher.
And finally, Automon can be dynamically enabled/disabled via the Automon MXBean (JMX).
AspectJ 'weaves' Automon monitoring code into your classes. This can be done...
Both approaches replace the original class files with ones that have monitoring added to them. Regardless of whether LTW, or BTW is used the generated class files are identical. LTW is more flexible as it lets you use the powerful AspectJ pointcut language at runtime to specify what classes you want to monitor. It also lets you monitor jdk classes and 3rd party library classes that you don't own such as java.net, jdbc, hadoop, spark etc. BTW only let's you monitor your own source code.
Here is a short video that shows how to monitor your code using Automon with LTW: Automon demo
The quickest way to get started with Automon is to download this distribution, and go to the examples directory and run the sample programs (*.sh). There are more directions on running the examples in the 'examples' directories README file.
If you are using Spring the following maven module shows how to monitor Spring beans with Automon. In particular look at the Spring applicationContext.xml file to see how to specify which Spring beans to monitor.
Automon does not require Spring though. Running a non-Spring program with Automon is easy too. You simply...
The examples directory shows how to invoke your programs using both LTW, and BTW.
Load Time Weaving (LTW) also involves providing an ajc-aop.xml config file. Review the config files for more information on them. The following maven projects generate plain (unwoven) java jars. Each of them has a *.sh script in the examples directory that lets you run the the java code with LTW.
Build Time Weaving (BTW) - And finally if you want to use Build Time Weaving in your maven build process refer to these BTW sample projects (In the examples I use 'woven' and BTW synonymously):
The examples directory has scripts (*.sh) to run these programs.
An interview that covers Automon can be found here.
Incorporate Automon into your maven project by adding the following dependency (using the most current version).
<dependency>
<groupId>org.automon</groupId>
<artifactId>automon</artifactId>
<version>1.0.3</version>
</dependency>
The code that generates the automon-{version}.jar file is contained in this directory.
And finally, if you need support contact us at Issues or email us at [email protected].
Thanks, and happy monitoring!
Steve