opentelemetry-java-contrib icon indicating copy to clipboard operation
opentelemetry-java-contrib copied to clipboard

Start-up profiler proposal

Open jeanbisutti opened this issue 1 year ago • 0 comments

It's a proposal to create a start-up profiler project in opentelemetry-java-contrib repository.

This profiler could help investigate why an application instrumented with the Opentelemetry agent is slow to start.

With a JFR setting using JVM options (-XX:StartFlightRecording=settings=profile,dumponexit=true,filename=profiling.jfr" / -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,disk=true,settings=profile,dumponexit=true,dumponexitpath=profiling.jfr), JFR profiling seems to starts after the execution of the premain method from my tests (Java 8 and Java 11). So, the initialization of the instrumentation of the OTel agent would not be profiled.

This start-up profiler would be a Java agent starting JFR in a programmatic way. The user would declare the profiler agent before the instrumentation agent: java -javaagent:opentelemetry-startup-profiler.jar -javaagent:opentelemetry-javaagent.jar -jar myapp.jar

For JVMs not supporting JFR, a profiler capturing thread dumps could be executed.

What do you think about this proposal?

If this profiler could be part of this project, I would create a first PR on the JFR profiling part.

jeanbisutti avatar Aug 25 '22 21:08 jeanbisutti