HTTP Monitoring with JAMon

Monitoring HTTP Requests

JAMon 2.7 introduces HTTP monitoring. JAMon HTTP Monitoring uses reflection to monitor different aspects of the containers HttpServletRequest, and HttpServletResponse objects. With JAMon you can monitor individual page performance, frequency of each http status code (200, 404 etc.), number of bytes returned in a response, Servlet exceptions and much more. As is always the case with JAMon HTTP monitoring can be enabled/disabled at run time.Http monitoring requires no application code changes. Simply use one of the following approaches:

Interpretting JAMon HTTP Data

By default JAMon will track something similar to the following (The screen snapshot was taken while monitoring tomcat6). However, with simple configuration via server.xml, or jetty.xml - any HttpServletRequest, or HttpServletResponse method that takes no arguments, and returns an Object can be monitored (i.e. request.getRequestURI() for example). This is covered in more detail later in this document. Note all HTTP monitors can be seen by entering 'http' into the jamonadmin.jsp 'filter' field.

The following describes JAMon's default HTTP Monitors:

Any JAMon buffer listener can be attached to any JAMon monitor. This allows you to not only look at the aggregate stats above, but look at interesting details such as the details of when the slowest page was executed, or the ServletException stack trace, or the most recent N page requests. See other parts of the JAMon documenation to learn more about JAMon Buffer Listeners. JAMon 2.7 introduces the HttpBufferListener which puts a stack trace in the details buffer should one occur during a page request. The following is an example of what one might look like. (Note stack traces can also be seen in any of the other buffer listeners, however not as a separate column). The following buffer listener was attached to 'com.jamonapi.http.JAMonTomcatValve.request.allPages', and so would have a FIFOBuffer of the last N requests. As always JAMon buffer listeners can be added/removed at runtime.

The first 4 lines of the report show successful page invocations. The columns represent the row number in the report (RowNum), the resource/page name (Label), the stack trace if one occurred (Exception), the execution time in ms. (LastValue), the number of pages that were executing when this one was (Active), and the date-time when the resource/page was invoked. The 5th line shows a page that had a stack trace.

Configuring the JAMon HTTP Monitor

JAMon can monitor various aspects of servlet requests and responses via declarative configuration. This is done via specifying a comma delimitted string in the server.xml, or jetty.mxl files, or programattically by calling the 'setSummaryLabel(String)' method. What follows is a sample tomcat valve that specifies the default monitors explicitly:

     <Engine name="Catalina" defaultHost="localhost">
     <Valve className="com.jamonapi.http.JAMonTomcatValve" summaryLabels="request.getRequestURI().ms as allPages, 
     request.getRequestURI() as page, 
     response.getStatus().value.httpStatus," />

The above causes the JAMonTomcatValve.setSummaryLabels method to be called with the comma delimitted String passed as an argument. A '.' separates tokens within one monitor. The String is parsed to the following 5 monitors.

Regardless which summary label you use JAMon will always put the page name, and stack trace (should there be one) in the details buffer. Note other methods that are part of the JAMonTomcatValve's and the JAMonJettyHandler can also be called in the same way 'setSummaryLabel' was called. Logo