I understood little bit of JaMon. But I am highly confused how it will monitor web applications/user interaction???
Say, I have a developed web application, have many classes and each class has many methods. Now, all classes doesn't necessarily implements interface so how JaMon will work in this case???
If at all, suppose all classes implements interface then do I need to write a separate program -- get object of those classes through monitor() method and call different-different methods -- to monitor performance???
If so, then where I measured, how much time it took when user performed any operation in my web application???
To answer your questions, a brief summary of jamon will help.
1) JAMon aggregates a number associated with a String/label. The more common use is to monitor execution time. Every time the 'start' method is called with the same label/string the following are tracked:hits, time stats (avg/min/max/std dev), concurrency stats, and more.
The data is viewable via the jamon web viewer.
It works like this: Monitor mon=MonitorFactory.start("myHomePage.jsp"); ..code.. mon.stop();
2) You can also aggregate any number (besides time) with the add method. You simply provide the label, units and value.
// this value will be aggregated with previous values that were called with the same label and units. MonitorFactory.add("filesize","MB",.5); MonitorFactory.add("purchases","$",125);
3) You can put the above methods in your code, however, JAMon also comes with a servlet filter and jdbc driver that require no application code changes. For the servlet filter you simply add a few items into your web.xml. The servlet filter will track page level statistics (equivalent to calling Monitor mon=MonitorFactory.start(pageName))
You can also use the jamon jdbc proxy driver. This driver will record performance statistics for any SQL issued by the driver (It does more than this, but this should give you the idea). The jamon proxy driver replaces values from the sql with '?' in the case of Statement objects, and for PreparedStatement leaves the '?' in. So in effect something like the following is executed by the driver: Monitor mon=MonitorFactory.start("select fname, lname from mytable where ssn=?")
So no matter how many times the above query is executed with different values for ssn, there will only be one row in the jamon report.
4) You can also monitor ANY java interface easily by using the following syntax: (assumes MyImplementation, and OtherObj are implementations of their respective interfaces)
I had this problem with Jamon 2.7 on GlassFish V2. It turns out that the jamonapi jar file doesn't seem to be included with the Jamon war file. Perhaps there's something in the instructions that I missed, or something went awry during deployment.
In any case, I resolved the problem by copying the jamon-2.7.jar file to the exploded war file 'lib' directory.
Joined: Aug 26, 2008
Posted too soon.
Add the jamon jar file to the appservers classpath - do not put the jar in multiple places. Otherwise you won't get all the monitors you expect.