Simplified Installation

The beet.jar library and dependencies should be included in the target application's library directory, e.g. WEB-INF/lib for web applications. beet is then enabled separately for tracking HTTP requests, Java method calls, and/or SQL queries. Behavior can be fine-tuned in many ways, see Chapter 3, Configuration Reference for details. The steps for a basic installation at all layers of an existing Spring application are:

  1. Add the library and its dependencies to the application.

  2. Add behavior tracking markup to your Spring applicationContext.xml file (modify values to suit your application):

    Example 1.1. Adding method and http tracking to applicationContext.xml

    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:bt="http://www.mantis-tgi.com/schema/bt/1.1"
           xsi:schemaLocation="
              http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
              http://www.mantis-tgi.com/schema/bt         http://www.mantis-tgi.com/schema/bt/mtgi-bt-1.1.xsd">
    
          <bt:manager application="myapp"1
                      track-method-expression="execution(* com.mtgi.analytics..*Tracked(..))"2>
             <bt:http-requests parameters="dispatch"/>3
          </bt:manager>
    1

    The name of this application, as it will appear in behavior tracking logs.

    2

    (optional) An AspectJ pointcut expression identifying which methods you want to track in your application. This example identifies "all methods in the com.mtgi.analytics package with names ending in "Tracked". For a detailed description of this grammar, see the AspectJ programming guide.

    3

    (optional) Enable limited HTTP request tracking. HTTP request tracking can also be enabled as a servlet filter with more fine-grained control. The "parameters" attribute is a comma-separated list of request parameters logged with each event.


  3. (optional) To enable behavior tracking at the SQL level, add a custom attribute to the data source declaration in your spring configuration:

    Example 1.2. Adding SQL tracking to applicationContext.xml

    <bean id="myDataSource" class="..." 
          bt:tracking-manager="defaultTrackingManager">1
    
       ... normal datasource configuration ... 
    
    </bean>
    1

    This name points back to an instance of the bt:manager element as described above, which is used to configure application-wide behavior tracking settings. This name is the id attribute of your bt:manager element, or defaultTrackingManager if bt:manager does not have an id.