Trouble Getting Started

2011-09-16
2013-05-20
  • Kyle Cacciatore

    Kyle Cacciatore - 2011-09-16

    Hi,

    I just downloaded JAMon, and have installed the admin war and valve into Tomcat 6.0.16.  I've created an aspect that creates Monitor objects as such:

            @Around("execute()")
        public Object profile(ProceedingJoinPoint pjp) throws Throwable {
            Object retVal;
            String str = pjp.getTarget().toString();
            Monitor mon = MonitorFactory.start(str);
            retVal = pjp.proceed();
            stopWatch.stop();
            mon.stop();
            return retVal;
        }
    

    Which executes for any method invocation a web app deployed to the same Tomcat instance. I was expecting to see monitor data show in the JAMon admin/reporting page, but I do not see any. I know the valve is set correctly, as I get fdsapi data in the admin page. I know I have the servlet filter configured on the target webapp, as I see statistics on page requests in same. I know the aspect is being invoked, as I see debug data (removed from above code example) display in the console output. Should I be creating the monitor a different way?

    Thanks,

    Kyle

     
  • Steve Souza

    Steve Souza - 2011-09-17

    The only problem I ever really see with jamon is that people have multiple jamon jars in the classpath.  What happens in this case is your aspect code would write to a jamon jar loaded with one classloader and the jamon war would display stats from a different jar loaded by a different classloader.   So that is probably your issue.

    As far as your code goes I would put jamon in a try finally block.  There will be no resource leak if you don't but your active count will not be decremented and so that stat will be skewed.  Also, what is stopWatch doing?  I don't see where you create that variable in the code. 

     
  • Kyle Cacciatore

    Kyle Cacciatore - 2011-09-17

    Thanks Steve - the 2nd jar is the likely culprit - I added them to tomcat/lib in order to install the valve, and I bet they war file I'm building has a jamon.jar  in it as well.  The stopwatch line was another spring class I was using to time method executions - I pulled the declaration out when I was removing non-relevant code from the example, and missed that line.

    Thanks!

    Kyle

     
  • surf11

    surf11 - 2012-10-11

    So I have a question.

    Does the  jamon.war (web app) need the jamon-2.73.jar file to run?  I would assume so, but I don't have it (the jar file) loaded anywhere on my jboss server and my jamon.war app runs just fine, showing stats on - i guess itself. Can somebody explain how this should be set up?

    I run windows and I have C: \ jboss-6.1.0.Final \ lib <- no jamon.jar there and the war app runs - is this correct?

    Thanks!

     
  • Steve Souza

    Steve Souza - 2012-10-11

    * Yes the jamon jar has to be there.  If jamon.war is working some version of jamon must be in your classpath.  Search the disk for jamon*.jar.  It is probably under jboss somewhere, but if someone set your system classpath it may be somewhere else.
    * I haven't tried it on jboss 6, but here are directions on setting it up on jboss in previous versions.  It is probably the same.

     
  • surf11

    surf11 - 2012-10-11

    Thanks for the quick reply!

    So strange, I am not seeing it anywhere - ok - I will keep hunting - the thing is - i DID have loaded in the lib directory but took it out to test it, and it keep working, Thought Jboss was caching, so restarted and even rebooted the machine - that app still works! Well at least I know it is find the jar somewhere - so thanks!

     
  • surf11

    surf11 - 2012-10-11

    Ok - I found it - it was stashed in one of the many places where jboss loads jars, in this case:

    C:\ jboss-6.1.0.Final \ server \ default \ lib

    So it's working and I am seeing results!

    Is there a way to configure the admin app from monitoring itself?

     
  • Steve Souza

    Steve Souza - 2012-10-11

    <<Is there a way to configure the admin app from monitoring itself?>>
    I don't understand your question.

     
  • Steve Souza

    Steve Souza - 2012-10-11

    Ok, I understand the question now.  Unfortunately there is no way to keep it from monitoring itself.  The war uses another api that I created (Formatted Data-set) that was instrumented with jamon.  Unfortunately I didn't provide a way to turn that off.  However, you could not display them by using a filter to exclude them. 

     
  • surf11

    surf11 - 2012-10-11

    Oh, it's cool, no big deal, I can use the filters. Hooking up some stuff now and I really like how it is looking - very useful tool!

     
  • Steve Souza

    Steve Souza - 2012-10-11

    good. glad it is working well.  Don't forget to include all the things jamon monitors without changing code such as jdbc/page requests/log4j/ejb's/exceptions.  Also look at the listeners that can be enabled via the web app.  Very handy for finding the most N recently slow queries etc.  Click on the database demo in the jamon admin war and play around with that to see some interesting jamon data.

     

Log in to post a comment.