Runtime performance monitoring made easy

JETM Springframework web integration

While JETM already supports web applications through filters and servlets mentioned here those integrations do not work with spring managed performance monitoring. This is because the generic web support locates the currently active EtmMonitor using an EtmManager that does not honour spring configurations.

Therefore JETM comes with dedicated Spring web application support. The JETM runtime will be retrieved from the currently active WebApplicationContext (using Spring WebApplicationContextUtils). So if you create your WebApplicationContext with ContextLoaderListener or ContextLoaderServlet simply use the classes below and you will use the JETM runtime from your spring configuration.

Usually the JETM runtime can be located automatically. However if you have more than one EtmMonitor you may need to specify the bean name for lookup. See below.

Spring HTTP console servlet

The Spring HTTP console servlet works - apart from the auto detection feature mentioned above - just like the generic implementation. Add the following xml fragment to your web.xml and your are able to access performance results at http://{HOST}:{PORT}/{ROOT}/performance/.

  ...

  <servlet>
    <servlet-name>performanceMonitor</servlet-name>
    <servlet-class>etm.contrib.integration.spring.web.SpringHttpConsoleServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  ...

  <servlet-mapping>
    <servlet-name>performanceMonitor</servlet-name>
    <url-pattern>/performance/*</url-pattern>
  </servlet-mapping>

If you have more than one EtmMonitor in your spring configuration use the servlet parameter etmMonitorName to specify the name of the monitor bean.

Spring HTTP request performance filter

The SpringHttpRequestPerformanceFilter is the spring equivalent to the generic HttpRequestPerformanceFilter. Use this filter to monitor HTTP requests.

  ...

  <filter>
    <filter-name>performance-monitor</filter-name>
    <filter-class>
      etm.contrib.integration.spring.web.SpringHttpRequestPerformanceFilter
    </filter-class>
  </filter>

  <filter-mapping>
    <filter-name>performance-monitor</filter-name>
    <url-pattern>*.action</url-pattern>
  </filter-mapping>

If you have more than one EtmMonitor in your spring configuration use the servlet parameter etmMonitorName to specify the name of the monitor bean.