Problem
Currently, the OTel Pyroscope integration only supports two modes:
- Bundled mode: Pyroscope agent is shaded into the extension JAR
- Java Agent mode: Pyroscope SDK is loaded via
-javaagent and accessed from SystemClassLoader
This limitation prevents integration with projects like async-profiler-actuator-endpoint, which provide profiling capabilities as a Spring Boot dependency rather than a Java agent.
Use Case
When using async-profiler-actuator-endpoint or similar libraries:
- The profiling SDK is added as a Maven/Gradle dependency
- Spring Boot manages the SDK lifecycle
- The SDK is loaded by the Application ClassLoader, not the SystemClassLoader
The current implementation in loadProfilerSdk() only attempts to load ProfilerSdk from ClassLoader.getSystemClassLoader():
private static OtelProfilerSdkBridge loadProfilerSdk() {
try {
ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
Class<?> sdkClass = systemClassLoader.loadClass("io.pyroscope.javaagent.ProfilerSdk");
// ...
} catch (Exception e) {
throw new RuntimeException("Error loading the profiler SDK", e);
}
}
This fails when the SDK is loaded as an application dependency because it's not visible in the SystemClassLoader.
Expected Behavior
The OTel extension should be able to detect and use Pyroscope SDK instances that are:
- Loaded as application dependencies (via Maven/Gradle)
- Managed by Spring or other frameworks
- Created lazily during application startup
Environment
- OTel Pyroscope Integration version: 1.0.4
- OpenTelemetry Java Agent version: 1.33.6
- Pyroscope SDK version: 2.0.0
Problem
Currently, the OTel Pyroscope integration only supports two modes:
-javaagentand accessed from SystemClassLoaderThis limitation prevents integration with projects like async-profiler-actuator-endpoint, which provide profiling capabilities as a Spring Boot dependency rather than a Java agent.
Use Case
When using
async-profiler-actuator-endpointor similar libraries:The current implementation in
loadProfilerSdk()only attempts to loadProfilerSdkfromClassLoader.getSystemClassLoader():This fails when the SDK is loaded as an application dependency because it's not visible in the SystemClassLoader.
Expected Behavior
The OTel extension should be able to detect and use Pyroscope SDK instances that are:
Environment