Webapp Trace Tool

Overview | Example | Building | Installation | History


Overview

Watt helps in understanding how web applications interact with the database by collecting information about each query that is run, and tying it to the request that caused the query.

To use Watt, you need at a minimum a Java development environment and a web application that interacts with the database and runs inside Tomcat. (Watt is likely to work with other servlet containers, but currently has only been used with Tomcat 5)

Example

The example pages are a static dump of the information that Watt generates. Of particular interest are

Building

To build watt, you need to do the following:

  1. Make sure you have the following RPM's installed from JPackage - most of these are required by Tomcat, too:
  2. Checkout the sources from the CVS repository. Let's call the top level directory of your checkout WATT

  3. Run ant pack in $WATT

Installation

After successfully building Watt, you need to do the following to install it under Tomcat and to instrument your web application (you will have to be root for most of these steps):

  1. Place $WATT/build/watt-core.jar in /var/lib/tomcat5/shared/lib
  2. Run build-jar-repository /var/lib/tomcat5/shared/lib log4j commons-lang
  3. Create a symbolic link to your database driver in /var/lib/tomcat5/shared/lib
  4. Place $WATT/build/watt.war into /var/lib/tomcat5/webapps or use Tomcat's manager application to deploy the WAR.

Now that Watt is installed, you need to instrument your webapp to use it:

  1. Add the WattFilter to the filters for your web application in your application's web.xml by adding something like:
      <filter>
        <filter-name>WattFilter</filter-name>
        <filter-class>net.watzmann.watt.WattFilter</filter-class>
      </filter>
     
      <filter-mapping>
        <filter-name>WattFilter</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>
  2. Instruct your web application to use the JDBC driver from Watt (class name net.watzmann.watt.sql.DsDriver), and provide your 'real' driver in the JDBC URL. The JDBC URL must have the format
    jdbc:watt:<driver_class>:<real_jdbc_url>
    For example, if you use MySQL, and your current JDBC URL is jdbc:mysql://localhost/mydb, change the URL to jdbc:watt:com.mysql.jdbc.Driver:mysql://localhost/mydb.
    If your are using Hibernate, change the hibernate properties to be
    hibernate.connection.driver_class=net.watzmann.watt.sql.DsDriver
    hibernate.connection.url=jdbc:watt:com.mysql.jdbc.Driver:mysql://localhost/mydb

With installation complete, restart Tomcat and go to http://yourserver:yourport/watt/Index.do. You should see a page that tells you that there is no request information. Request a few pages in your web application and reload http://yourserver:yourport/watt/Index.do; you should now see information for each request that you made.

History

The first incarnation of this idea was implemented by Joe Banks at Arsdigita in 2001 as the developer support for Arsdigita's Java product. It continued its life as part of RedHat's CCM in various guises, and is now part of the open-source successor of CCM, Byline. Watt is a reimplementation and extension of the developer support in Byline; among other things, it can now be used with any web application and any JDBC database driver.


Last modified: 2005-07-29