RFR: 8356698: JFR: @Contextual
Erik Gahlin
egahlin at openjdk.org
Sun Jun 1 21:49:51 UTC 2025
On Sat, 31 May 2025 18:58:29 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:
>> Could I have a review of a new annotation that can be used to annotate a field as contextual.
>>
>> Testing: jdk/jdk/jfr + tier1
>>
>> Thanks
>> Erik
>
> src/jdk.jfr/share/classes/jdk/jfr/events/MethodTraceEvent.java line 39:
>
>> 37: public final class MethodTraceEvent extends AbstractJDKEvent {
>> 38:
>> 39: @Contextual
>
> Should the MethodTraceEvent's method field really have this annotation? Or is it a remnant from testing?
I think it can be useful if a contextual GUI is created where users can drill down into tables and see all events that occur during a method call. For example, if you want to troubleshoot a slow login:
$ java -XX:StartFlightRecording:method-trace=LoginService::login ...
| Context Types
|-----------------------------------
| Order::id
| **MethodTrace::method** (selected)
| Trace::span
| Trace::name
|Context Values
|-----------------------------------
| **LoginService::login(String, String)** (selected)
Start Time | Event Type | Duration
--------------|-----------------------|-------------
20:05:02.45 | jdk.JavaMonitorEnter | 25 ms
20:05:03.12 | jdbc.ExecuteQuery | 2 s
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25249#discussion_r2119629183
More information about the hotspot-jfr-dev
mailing list