RFR: 7033: Allow overriding the id (name) of the event type

Gunnar Morling github.com+28612+gunnarmorling at openjdk.java.net
Thu Dec 3 10:25:07 UTC 2020


On Mon, 30 Nov 2020 19:51:23 GMT, Gunnar Morling <github.com+28612+gunnarmorling at openjdk.org> wrote:

> @thegreystone et al., this PR proposes two changes to the names of generated event types and their fields:
> 
> * An explicit event type name is derived from the name given in the configuration, instead of using the class name; this is nicer to work with e.g. when enabling/disabling event types for recordings
> * the "field" prefix is removed from event type field names; when examining e.g. `RecordedEvent` instances, names are nicer to look at that way IMO
> 
> Could you log an issue for this change if you agree it's desirable? Thanks! I ran into these issues while using JMC Agent for [tracking SQL statements](https://twitter.com/gunnarmorling/status/1333152245463064579); note the odd "fieldSQLQuery" name marked on the left; the event type name is already adjusted in this screenshot as per this PR here.

agent/src/main/java/org/openjdk/jmc/agent/jfrnext/impl/JFRNextEventClassGenerator.java line 236:

> 234: 		// Name
> 235: 		av = cw.visitAnnotation("Ljdk/jfr/Name;", true);
> 236: 		av.visit("value", TypeUtils.deriveIdentifierPart(td.getEventName()) + "Event");

@thegreystone, reading your comment in #171, should we actually derive the name from the id then? I was wondering about that, too.

-------------

PR: https://git.openjdk.java.net/jmc/pull/170


More information about the jmc-dev mailing list