BTrace 3.0.0 is the first major release since 2.2.6 (November 2024): a new package namespace, a new license, a single-jar distribution, an extension framework with permissions, a much shorter script syntax, a binary wire protocol, and instrumentation that keeps working on class files newer than the validated ASM ceiling.
Upgrading from 2.x is mostly automatic; read the migration guide first. Everything below is documented in the documentation hub.
- New home:
io.btrace. Sources, Maven coordinates (io.btrace:btrace), and the runtime API moved fromorg.openjdk.btrace. Probes compiled with 2.x keep working: the agent rewrites the old package references when it loads a persisted probe. - Apache License 2.0. BTrace was GPLv2 with the Classpath Exception.
- One jar.
btrace.jaris the agent, the client, and the boot artifact at once. Its internal classes are stored as masked classdata (renamed resources the JVM does not see as classes), so ASM, the compiler, and the engine stay invisible to the target application's classpath. - Extensions with permissions. Bundle services into isolated, permission-gated extensions
(
@Injected), manage them with the newbtracexCLI, and ship the bundled ones: metrics (HdrHistogram), StatsD, contracts, LLM tracing, RAG quality, GPU bridge, utilities. - Flat DSL and auto-imports. Scripts no longer need
BTraceUtils.prefixes or import boilerplate;import static io.btrace.BTrace.*andimport io.btrace.core.annotations.*are injected for you. - Oneliners.
btrace -n 'com.acme.*::* @return if duration>100ms { print method, duration }' <pid>deploys a probe without writing a file. - Binary wire protocol (V2) is the default, with automatic V1 fallback so 2.x clients and agents still talk to 3.0 ones on dynamic attach.
- ClassFile API instrumentation backend. The bundled ASM handles class files up to the Java 27
class-file version, the agent's validated ASM ceiling. On JDK 24+ agents, classes newer than
that (Java 28 early-access builds today) are instrumented through the JDK's ClassFile API
instead; every probe kind and handler parameter works there, with one documented exception
(
@DurationonSYNC_ENTRY/SYNC_EXIThandlers). - Authenticated prepared mode and
btrace doctor. Prepared mode is a JVM started with the agent and no startup script, waiting for a later client connection.-javaagent:btrace.jar=port=0binds a loopback, token-protected endpoint that 3.0 clients discover through the Attach API (a plain-javaagent:btrace.jardoes the same on port 2020);btrace doctor <pid>reports readiness before and after attach. - Fat agents and containers. The
io.btrace.fat-agentGradle plugin embeds extensions and startup probes into a single-javaagentjar; official Docker images (ghcr.io/btraceio/btrace:3.0.0,-alpine,-distroless) ship the distribution as a layer. - AI-assisted debugging. The MCP server now lives in the
btraceio/agent-pluginsrepository as thebtrace-observabilityplugin. - Telemetry is opt-in only (
telemetry=trueagent argument); the default agent start performs no network operation.
org.openjdk.btrace.*sources must be renamed toio.btrace.*(or drop the imports and rely on auto-imports);scripts/migrate-btrace-script.shdoes the rewrite. Compiled probes need no change.- The
btrace-agent.jar/btrace-boot.jar/btrace-client.jarlayout is gone; point launch scripts atlibs/btrace.jar. Onlyio.btrace:btraceis published to Maven Central; thebtrace-agent,btrace-client,btrace-boot, andbtrace-instrartifacts are not. - Permissions are declared by extensions and granted on the agent side (
allowExtensions=,allowPrivileged=, or the permission policy file); the client has no--grantflag, and thegrant=/deny=/grantAll=agent arguments are accepted but have no effect. (The probe-level@RequestPermission(s)annotations seen in 3.0 pre-release builds were removed before release and never existed in 2.x.) - The
AggregationsAPI (Aggregations.newAggregation,AggregationFunction,addToAggregation,printAggregation,clearAggregation) was removed. Use the bundledbtrace-metricsextension for histograms and stats, or plain counters and maps fromBTraceUtils. libs=<profile>andbtrace-libs/profiles were removed, not deprecated: the agent logs an error and loads nothing. Migrate to extensions.- Prepared mode (
-javaagent:btrace.jar=port=...) now requires authentication before every command and binds loopback only; a 2.x client cannot connect to a 3.0 prepared endpoint (dynamic attach remains compatible). Remote prepared-mode operation is not supported in 3.0.0. - The Maven fat-agent plugin was never published and is not part of 3.0; use the Gradle plugin.
- Running BTrace against a JVM older than Java 17. BTrace 3.0 runs on Java 8–27+, and pre-17
targets keep working throughout 3.x, but the agent and client print a one-time warning. Support
for Java < 17 will be removed in 4.0. Suppress the warning with
-Dbtrace.suppressJavaDeprecationWarning=true(on the target JVM for the agent notice, on the client JVM for the console notice).
- Probe handlers are dispatched through
invokedynamiccall sites that become no-ops when the client exits, so retracting a probe leaves no lingering overhead. btrace --versionreports the build commit.
sdk install btrace # SDKMAN
jbang io.btrace:btrace:3.0.0 <pid> ... # JBang
curl -LO https://github.com/btraceio/btrace/releases/download/v3.0.0/btrace-v3.0.0-bin.tar.gz
sudo dpkg -i btrace_3.0.0-1_all.deb # Debian/Ubuntu (release asset)
sudo rpm -i btrace-3.0.0-1.noarch.rpm # RPM-based (release asset)
docker pull ghcr.io/btraceio/btrace:3.0.0Maven: io.btrace:btrace:3.0.0. Gradle plugins: io.btrace.extension, io.btrace.fat-agent.