Java mission control's flight recording feature looks great and seems to be perfect for troubleshooting production issues for e.g. high cpu. I had a question - Can the flight recording be triggered programmatically from with the java application? I understand that flight recording could be triggered through jvm options like -XX:StartFlightRecording=duration=60s,filename=myrecording.jfr but this is not what I am referring too. I am also aware of the fact that using flight recording in production environments requires a Java SE Advanced License.
I see two advantages in doing programmatic triggering of the flight recording
1. Avoids manual intervention in connecting to all production environments (which seems practically impossible when there are more than hundreds of jvms running)?
2. Less reliability on the support & operations team to know how to do flight recording?
I visualize it to be triggered by a thread which monitors jmx metrics periodically (for e.g. ProcessJVMLoad) and triggers a flight recording if the value goes above 90% (for 3 times consecutively). The flight recording could be a specific duration and the location could be picked from configuration.