Package io.opentelemetry.javaagent.spi
Interface ComponentInstaller
-
public interface ComponentInstallerComponentInstallercan be used to install any implementation providers that are used by instrumentations. For instance Java agent uses this to install OpenTelemetry SDK. The instrumentation uses shaded OpenTelemetry API that lives in the bootstrap classloader and the implementation (SDK) is installed via service loader from agent's classloader. This way the application does not have a direct access to the OpenTelemetry SDK classes. The same approach can be done for other APIs used by custom instrumentations.This is a service provider interface that requires implementations to be registered in
META-INF/servicesfolder.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidafterByteBuddyAgent(io.opentelemetry.instrumentation.api.config.Config config)Runs after instrumentations are added to ByteBuddy.default voidbeforeByteBuddyAgent(io.opentelemetry.instrumentation.api.config.Config config)Runs before instrumentations are installed to ByteBuddy.
-
-
-
Method Detail
-
beforeByteBuddyAgent
default void beforeByteBuddyAgent(io.opentelemetry.instrumentation.api.config.Config config)
Runs before instrumentations are installed to ByteBuddy. Execute only a minimal code because any classes loaded before the instrumentations are installed will have to be retransformed, which takes extra time, and more importantly means that fields can't be added to those classes and InstrumentationContext falls back to the less performant Map implementation for those classes.
-
afterByteBuddyAgent
default void afterByteBuddyAgent(io.opentelemetry.instrumentation.api.config.Config config)
Runs after instrumentations are added to ByteBuddy.
-
-