BTrace attaches to live Java 8–27 JVMs with one-line probes for timings, exceptions, and custom scripts, then detaches without leaving bytecode changes.
Overview
BTrace 3.0 targets production-safe dynamic tracing of running JVMs. Short oneliners can print slow methods, exception paths, or custom probe output, and Ctrl-C removal restores original bytecode without requiring a restart or startup agent flags.
Probes run in a restricted language subset verified before load, with operator caps on rates and lifetimes. Beyond oneliners, annotated probe classes support richer introspection of arguments, returns, fields, and allocations.
Distribution options include archives, packages, JBang, Docker images, and a fat agent JAR for Spark, Hadoop, or Kubernetes environments. Extensions add integrations such as StatsD with explicit permission grants for privileged capabilities.
An MCP server angle is advertised for coding-agent observability workflows alongside traditional CLI attach flows.
Key features
- One-line live JVM probes
- Detach restores bytecode
- Restricted safe probe language
- Method timing oneliners
- Exception tracking probes
- Docker and fat agent JAR
- StatsD extension support
- Java 8 through 27 support
Use cases
- Diagnosing slow Java methods
- Production exception tracing
- Temporary performance snapshots
- Kubernetes JVM diagnostics