Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8364086

JFR: Validate user-defined event metadata

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • 26
    • 26
    • hotspot
    • None
    • jfr

      When creating JFR events, many users struggle with providing proper metadata, such as a namespace for the event name, or correct capitalization for labels. For JDK events, there exists a test (jdk/jfr/event/metadata/TestEventMetadata.java), but for user-defined events, there is no alternative. One idea would be to make it an opt-in feature, for example:

          $ java -Xlog:jfr-metadata-validate=info -jar application.jar

      It would be good if the JDK events could piggyback on the same mechanism, for example:

          $ java -Xlog:jfr-system-metadata-validate=info -version

      Most of the JDK events should be fine, but there might be a few places where we don't comply with the guidelines, but must keep what we have for compatibility reasons. Instead of a separate tag set with a system tag, we could add exceptions for those in the validator if the events are defined in the boot class loader.

      When we see new events being added to libraries or applications in open source projects, we could just write: "Validate the event metadata with -Xlog:jfr-metadata-validate=info" and they will likely fix the issues. It's much easier than pointing to the guidelines in the Javadoc.

      One problem with this approach is that it might take a decade before users are on a JDK version with this functionality, for their library or application. Maybe we need to add it to the jfr-tool as well.

          $ jfr metadata --validate recording.jfr

      and return a non-zero exit status, so it can be used in continuous integration.

            egahlin Erik Gahlin
            egahlin Erik Gahlin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: