This guide helps you move from btrace-libs/<profile> to extension-based integrations.
- Security & isolation: extensions use API on bootstrap and isolated impls; libs/profiles mutate global classpaths.
- Operability: discovery, enable/disable, permissions, diagnostics.
- Maintainability: versioning and conflict handling.
libs/profiles are deprecated now. Planned removal: N+2 minor releases.- Runtime warning is emitted when
libsis used. - The new escape hatch is
-Dbtrace.system.appendJar=/abs/path/lib.jar(trusted-only, discouraged).
- Runtime warning is emitted when
-
Inventory usage:
- Identify profile(s) used (e.g.,
spark-driver,spark-executor,hadoop). - List the APIs probes rely on; isolate to a minimal contract.
- Identify profile(s) used (e.g.,
-
Create an extension:
- API module: minimal interfaces/DTOs (no app types), packaged to bootstrap.
- Impl module: reflective adapters; declare app deps as compileOnly/provided.
-
Replace profile dependency:
- Remove
libs=<profile>from agent args. - Enable the extension in
extensions.conf.
- Remove
-
Replace classpath assumptions:
- Update probes to pass app objects to API methods (object hand-off) instead of importing app types.
- In impl, resolve types via TCCL/defining loader.
-
Configure runtime:
- Add role/config keys to
extensions.conf(e.g., role=driver|executor; optional classpath hint if the app doesn’t ship libs). - Request permissions (REFLECTION, THREADS, SYSTEM_PROPS; CLASSLOADER only if needed).
- Add role/config keys to
-
Validate:
- Launch/attach runs; verify extension loads and links lazily/eagerly as required.
- Confirm failure handling (no-op shims) and logs.
If immediate migration is not feasible and the app must see a jar on the system classpath:
-Dbtrace.system.appendJar=/abs/path/lib.jar -Dbtrace.trusted=true
- Restricted to
BTRACE_HOMEunless-Dbtrace.allowExternalLibs=true. - One jar only; discouraged; subject to removal.
For Spark/Hadoop/Kubernetes environments where managing separate extension JARs is impractical, use fat agent builds to embed extensions directly.
plugins {
id 'io.btrace.fat-agent'
}
btraceFatAgent {
baseName = 'my-btrace-agent'
embedExtensions {
project(':my-spark-extension')
maven('io.btrace:btrace-metrics:2.3.0')
}
}Build: ./gradlew fatAgentJar
<plugin>
<groupId>io.btrace</groupId>
<artifactId>btrace-maven-plugin</artifactId>
<version>${btrace.version}</version>
<configuration>
<outputName>my-btrace-agent</outputName>
<extensions>
<extension>io.btrace:btrace-metrics:${btrace.version}</extension>
</extensions>
</configuration>
</plugin>Build: mvn package
# Spark
spark-submit --conf spark.driver.extraJavaOptions=-javaagent:my-btrace-agent.jar ...
# Kubernetes
java -javaagent:/opt/btrace/my-btrace-agent.jar MyAppSee Fat Agent Plugin Architecture for details.
- See provided-style extension guide:
docs/architecture/provided-style-extensions.mdfor Spark/Hadoop templates andextensions.confsnippets.