User-defined events may carry information that is relevant to other events that happen in the same thread at the same time. For example, an HTTPRequest event may contain a URL field. If the thread is stalled, perhaps because of a slow database query, troubleshooting could be simplified if the request URL was associated with the SQLQuery event.
Users can correlate these events today by manually examining other events that occur in the same thread while the HTTP request was being processed, but this is a cumbersome task. GUI and tooling can attempt to automate this process, but they lack knowledge of which fields provide contextual information. If a user-defined field could be annotated with @Contextual, that information could be propagated and potentially displayed as an additional field in the SQLQuery event.
The @Contextual annotation is purely informational. Mechanisms related to contextual events that change the behavior of JFR, such as:
- Recording everything during an event (a.k.a. "laser-pointing")
- Triggering a higher-level event when a lower-level event occurs (cascading)
- Sampling of events (throttling)
are orthogonal to it and can be implemented independently. For more information, see CSR.
Users can correlate these events today by manually examining other events that occur in the same thread while the HTTP request was being processed, but this is a cumbersome task. GUI and tooling can attempt to automate this process, but they lack knowledge of which fields provide contextual information. If a user-defined field could be annotated with @Contextual, that information could be propagated and potentially displayed as an additional field in the SQLQuery event.
The @Contextual annotation is purely informational. Mechanisms related to contextual events that change the behavior of JFR, such as:
- Recording everything during an event (a.k.a. "laser-pointing")
- Triggering a higher-level event when a lower-level event occurs (cascading)
- Sampling of events (throttling)
are orthogonal to it and can be implemented independently. For more information, see CSR.
- csr for
-
JDK-8356699 JFR: @Contextual
-
- Draft
-