Forum Stats

  • 3,874,115 Users
  • 2,266,686 Discussions
  • 7,911,730 Comments

Discussions

JFR / JMC custom events for Servlets / Tomcat

rgoldberg
rgoldberg Member Posts: 12
edited Oct 26, 2015 4:06AM in Java Mission Control

I'm starting to use JFR / JMC 5.5 from Oracle Java SE 8u66.

Are there any custom events for servlets (either generic servlets, or specifically for Tomcat 7 or 8)?

Mainly, I want to record duration events (or possibly time events) for servlet request / filter processing.  I might want to be able to record events from the start of the container processing a request to having sent back the response, the time a filter takes, and the time the servlet service method takes.  The first would include the latter two, and some container code runtime, too, so the first would probably have to be container-specific (unless I hooked into some standard java server networking code that's used by all containers, but I double anything common exists at the level that associates a request start with a response end).  The latter two situations, however, should be able to be handled by non-container-specific events, right?

I've heard about the WLS custom events.  I see that I can install them from the JMC UI.

Would they work at all with servlets in other containers?  I assume not.

Are they open source?

Are the following pages the best resources for learning about custom events?  Has anything changed?:

Creating Custom JFR Events | Marcus Hirt

http://docs.oracle.com/javacomponents/

Thanks.

Answers

  • rgoldberg
    rgoldberg Member Posts: 12
    edited Oct 25, 2015 3:03PM

    It looks like the com.oracle.jrockit.jfr package and its sub packages are deprecated, but the jdk.jfr.events package is still used, and there's a new oracle.jvm.hotspot.jfr package.

    The description of custom events on Marcus Hirt's blog seems to be for the deprecated API.

    Is there any documentation / JavaDocs for the new API?  Is any of this code open source, so I can read comments, etc.?

    e.g., the new Producer class doesn't have a register() method, and only has one constructor, which takes in an implementation of sun.jvm.hotspot.debugger.Address.  So I'm not sure how Producers are supposed to work in the new API.

    Thanks for any info.

  • Hirt-Oracle
    Hirt-Oracle Member Posts: 268
    edited Oct 26, 2015 4:06AM

    No, the WLS specific events only work with WLS. In JDK 9, we are making the API for creating custom events supported. It is, in some ways, very different. Creating events will be much easier, and the notion of a producer will be gone.

    As you have noted, the old API entered the code base deprecated. As of yet, there is no documentation available yet for the new API. Documentation will be released together with JDK 9. It will include supported APIs (POJO & JMX) for controlling the Flight Recorder as well.

    As soon as the API has been released, I will blog some examples.

This discussion has been closed.