Attach now
Best for ad-hoc diagnosis on a reachable live JVM.
btrace <PID> probe.javaAttach guide →Open-source Java diagnostics
+BTrace helps you safely trace and diagnose live Java applications. Find the slow call, reveal the swallowed exception, and move on—without a restart or redeploy.
+ +$ btrace -n 'OrderService::* @return if duration>200ms { print method, duration }' 8421✓ chargeCard306 ms✓ processOrder331 mswatching live methods · ctrl-c to detachBTrace + JFR: generate targeted probes live and add custom events to a continuous recording.
+More context: JFR keeps the history while BTrace adds on-demand instrumentation when questions arise.
+ Explore the workflow +Start with a question
+Pick a diagnostic goal. The command is generated in your browser and never leaves your machine.
+Your BTrace oneliner
+
+
+ That is a reusable Java probe. Start with this equivalent script, then add the advanced feature you need.
+
+
+ Learn when to move from an oneliner to a script
+ Start where it hurts
+BTrace is most useful when you have a concrete question about a running process.
+Trace a method’s duration and keep only the calls that cross your latency budget.
Build a latency probe → +Capture the stack where a caught or swallowed exception actually escaped.
Build an exception probe → +Find slow JDBC statement execution before you start guessing about the database.
Build a SQL probe → +Run a ready-made probe that reports deadlocked Java threads periodically.
View sample probe → +Follow files, URLs, and sockets opened by an application you did not write.
Browse samples → +Use custom events when you need low-overhead data for later analysis.
Explore JFR integration → +Grow with the question
Attach an oneliner to answer a focused live question.
Turn the oneliner into a Java probe and keep it with your service.
Add thread-local state, sampling, aggregations, metrics, or JFR events.
Ship a startup agent or fat agent when the diagnostic belongs in deployment.
Fit your environment
Choose the smallest deployment step that answers the question.
Best for ad-hoc diagnosis on a reachable live JVM.
btrace <PID> probe.javaAttach guide →Best when you know the probe before the application starts.
-javaagent:btrace.jarAgent guide →Best for interactive troubleshooting in Docker and Kubernetes.
shareProcessNamespace: trueSidecar guide →Best when extensions and the agent must travel as one artifact.
./gradlew fatAgentJarFat-agent guide →Targeted by design
BTrace is built for safe, temporary instrumentation—not permanent fleet monitoring or application behavior changes.
Prefer exact classes and methods. Use thresholds, sampling, and shallow stacks on hot paths.
Attach normally requires the same OS user, an attachable JVM, and the right container permissions.
Use JFR for continuous, low-overhead history; use BTrace for targeted custom instrumentation.
New diagnostic workflows
The BTrace MCP server lets compatible AI clients deploy probes and surface results through a diagnostic conversation. BTrace also ships reusable agent plugins that connect BTrace, JFR, and async-profiler into evidence-driven performance workflows.
Which methods in my service take more than 100 ms?
BTrace attaching a bounded latency probe…
Found 2 methods
PaymentClient.authorize · p95 243 ms
OrderService.checkout · p95 271 ms
The BTrace ecosystem
Focused open-source projects for Java developers and operators.
Production-safe dynamic tracing and diagnostics for live Java applications.
Curated integrations and richer diagnostic capabilities for BTrace.
Open project →An experimental Java Flight Recorder parser for exploring JVM event data.
Open project →Reusable skills for Claude Code, Codex, and Pi that connect live tracing with JFR and async-profiler analysis.
Open project →