A servlet filter that generates JFR events.
<dependency>
<groupId>com.github.marschall</groupId>
<artifactId>jfr-servlet</artifactId>
<version>2.0.0</version>
</dependency>
This project requires Java 11.
Versions 1.x are for the javax.servlet
namespace, versions 2.x are for the jakarta.servlet
namespace.
If your web application is not metadata-complete then you only need to add the dependency.
If your web application is metadata-complete
then you manually need to add the filter com.github.marschall.jfr.servlet.JfrFilter
and map it.
<filter>
<filter-name>JfrFilter</filter-name>
<filter-class>com.github.marschall.jfr.servlet.JfrFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>JfrFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
<dispatcher>ASYNC</dispatcher>
</filter-mapping>
A single request may traverse the servlet chain multiple times, either because of a server side redirect or because of asynchronous processing. We generate a unique exchangeId for every request so that multiple dispatches of the same request can be correlated.