I'm struggling to model asynchronous servlet request processing with custom JFR events.
The challenge I'm facing is that in asynchronous processing a request may be #dispatch()ed several times. This means the whole request processing chain may be executed multiple times, some time apart in different threads. How do I model this with custom JFR events?
What would help me is either the concept of a "parent" event (possibly in a different thread) or the suspension and resumption of an event.
Edit
To illustrate the issue a bit. An async request may take 100 seconds wall clock time to process. However the actual processing may happen in only 4 seconds user time in a Servlet#service() method:
- second 0-1 in thread A, Servlet#service()method returns,AsyncContextstarted
- second 10-11 in thread B, Servlet#service()method returns,AsyncContextstarted
- second 80-81 in thread A, Servlet#service()method returns,AsyncContextstarted
- second 99-100 in thread C, Servlet#service()method returns
I'm only interested in generating events for these four durations in these three threads and then correlating them with a single request.
 
     
     
    