CometD is an HTTP-based event routing bus for transporting asynchronous messages over HTTP. CometD provides both a JavaScript API and a Java API and is often used for real-time interactive applications such as multi-player games and chat rooms.

CometD is distributed as a WAR file. When you instrument the CometD application container that runs the WAR (typically a Jetty server) with the Java agent, AppDynamics automatically detects and tracks CometD activity, as described in the following section.

About the Built-in Support

AppDynamics supports both the WebSocket and the HTTP long-polling client transports in CometD. It tracks CometD messages as they traverse channels using POJO rules that split business transactions based on channel name.

Accordingly, business transactions in AppDynamics correspond to CometD channels. The following screenshot shows a business transaction generated for the /market/nyse channel: 

AppDynamics provides built-in exclude rules for the servlets that implement CometD transport functions, org.cometd.annotation.AnnotationComet and org.cometd.server.CometdServlet. For best results, you should exclude tracking for the container servlet as well, as described in the next section.  

Create Container Transport Servlet Exclude Rules

CometD is implemented as a servlet. Since the servlet implements transport activity, you should create exclude rules for the servlets that perform the CometD transport function. This ensures that the results of business transaction discovery do not obscure the POJO-based BTs corresponding to CometD channels. 

CometD is generally contained within a Jetty container, so the rules should exclude the Jetty container tracking in most cases. For Jetty, you should configure exclude rules for these Jetty servlets:

  • EQUALS, org.eclipse.jetty.server.handler.ContextHandler
  • EQUALS, org.eclipse.jetty.servlet.ServletContextHandler
  • ENDSWITH, jetty.plugin.JettyWebAppContext

If using another type of container, you should create similar exclude rules for the equivalent supporting classes.