# btraceio/btrace

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/btraceio-btrace).**

5,989 stars · 956 forks · Java · Apache-2.0

## Links

- GitHub: https://github.com/btraceio/btrace
- awesome-repositories: https://awesome-repositories.com/repository/btraceio-btrace.md

## Topics

`btrace` `java` `java-application` `java-platform`

## Description

btrace is a JVM dynamic tracing tool and performance profiler used for injecting safe instrumentation scripts into a running Java Virtual Machine without requiring a process restart. It functions as a Java agent framework and a Model Context Protocol server, exposing JVM diagnostic operations and tracing tools to large language models and AI assistants.

The project distinguishes itself by enabling real-time code injection and bytecode-level instrumentation via a secure binary protocol. It ensures production stability through a static safety analysis engine that blocks unstable code patterns, such as loops and allocations, during the script compilation phase.

The system covers a broad range of observability capabilities, including method execution tracing, object allocation tracking, and field access monitoring. It provides performance profiling via latency metrics and execution data sampling, and can emit custom Java Flight Recorder events for native analysis.

The agent supports flexible deployment strategies, including bootstrapping at startup or attaching to live processes in containerized environments using fat JAR bundles.

## Tags

### Programming Languages & Runtimes

- [Java Instrumentation Frameworks](https://awesome-repositories.com/f/programming-languages-runtimes/java-instrumentation-frameworks.md) — Provides a complete framework for building and deploying Java agents that perform bytecode-level instrumentation.
- [JVM Instrumentation Toolkits](https://awesome-repositories.com/f/programming-languages-runtimes/jvm-instrumentation-toolkits.md) — Provides a toolkit for injecting and executing custom logic into a running Java Virtual Machine without requiring a restart.
- [Runtime Agent Attachment](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-agent-attachment.md) — Provides the ability to attach an instrumentation agent to a live Java Virtual Machine process without restart.
- [Bytecode Instrumentation Agents](https://awesome-repositories.com/f/programming-languages-runtimes/bytecode-instrumentation-agents.md) — Modifies compiled bytecode at runtime to inject monitoring logic at method entry, return, and exception points.
- [Startup Agent Bootstrapping](https://awesome-repositories.com/f/programming-languages-runtimes/dynamic-class-creation/class-loading-mechanisms/class-loading-interception/java-agent-class-transformers/startup-agent-bootstrapping.md) — Starts applications with a pre-loaded agent to ensure instrumentation is active from the earliest launch stages. ([source](https://github.com/btraceio/btrace/blob/develop/docs/QuickReference.md))
- [Thread-Local State Management](https://awesome-repositories.com/f/programming-languages-runtimes/thread-local-state-management.md) — Stores independent data copies for each thread to track state across different instrumentation handlers. ([source](https://github.com/btraceio/btrace/blob/develop/docs/BTraceTutorial.md))

### System Administration & Monitoring

- [Method Execution Tracking](https://awesome-repositories.com/f/system-administration-monitoring/runtime-resource-tracking/method-execution-tracking.md) — Captures method entry, exit, and return values to analyze timings and track execution flow. ([source](https://github.com/btraceio/btrace#readme))
- [Dynamic Tracing Tools](https://awesome-repositories.com/f/system-administration-monitoring/automatic-tracing-instrumentation/java-integrations/dynamic-tracing-tools.md) — Acts as a dynamic tracing tool for injecting safe instrumentation scripts into running JVMs.
- [Live Process Code Injection](https://awesome-repositories.com/f/system-administration-monitoring/diagnostic-tools/diagnostics/memory-profilers/live-process-code-injection.md) — Injects and executes compiled scripts into an active JVM process to extract internal state without termination. ([source](https://github.com/btraceio/btrace/blob/develop/docs/QuickReference.md))
- [Application Performance Profiling](https://awesome-repositories.com/f/system-administration-monitoring/performance-monitoring-tools/application-performance-profiling.md) — Measures method execution durations and analyzes call stacks to identify bottlenecks in live Java applications.
- [LLM Interfaces](https://awesome-repositories.com/f/system-administration-monitoring/system-diagnostic-interfaces/llm-interfaces.md) — Exposes runtime diagnostic operations to language models through a common protocol for simplified troubleshooting. ([source](https://github.com/btraceio/btrace/tree/develop/btrace-mcp-server))
- [Data Access Tracing](https://awesome-repositories.com/f/system-administration-monitoring/data-access-tracing.md) — Intercepts and monitors reads and writes to specific object fields and arrays during JVM runtime. ([source](https://github.com/btraceio/btrace/blob/develop/CLAUDE.md))
- [Lifecycle Startup Tracing](https://awesome-repositories.com/f/system-administration-monitoring/distributed-tracing-instrumentation/lifecycle-startup-tracing.md) — Instruments the application before its main code executes to capture early lifecycle events. ([source](https://github.com/btraceio/btrace/wiki/Home))
- [Execution Event Sampling](https://awesome-repositories.com/f/system-administration-monitoring/execution-event-sampling.md) — Captures a representative subset of runtime events to minimize the performance overhead of tracing. ([source](https://github.com/btraceio/btrace/tree/develop/docs))
- [Execution Sampling Filters](https://awesome-repositories.com/f/system-administration-monitoring/execution-sampling-filters.md) — Reduces instrumentation overhead by capturing only a fraction of method invocations based on sampling rates.
- [Ad-hoc Diagnostic One-liners](https://awesome-repositories.com/f/system-administration-monitoring/execution-tracing/ad-hoc-diagnostic-one-liners.md) — Allows executing concise command-line scripts to perform quick debugging tasks like counting invocations or filtering slow methods. ([source](https://github.com/btraceio/btrace#readme))
- [Field Access Tracking](https://awesome-repositories.com/f/system-administration-monitoring/field-access-tracking.md) — Intercepts reads and writes to specific object fields to monitor state changes in real-time. ([source](https://github.com/btraceio/btrace/tree/develop/docs))
- [JFR Event Producers](https://awesome-repositories.com/f/system-administration-monitoring/jfr-event-producers.md) — Creates and emits custom Java Flight Recorder events from dynamic instrumentation probes for native performance analysis.
- [Dynamic Probe Toggles](https://awesome-repositories.com/f/system-administration-monitoring/logging-and-telemetry/dynamic-binary-instrumentation/dynamic-kernel-probes/user-defined-probes/application-level-probes/dynamic-probe-toggles.md) — Allows toggling sets of instrumentation probe handlers at runtime to adjust diagnostic detail. ([source](https://github.com/btraceio/btrace/blob/develop/docs/BTraceTutorial.md))
- [Probe Lifecycle Management](https://awesome-repositories.com/f/system-administration-monitoring/logging-and-telemetry/dynamic-binary-instrumentation/dynamic-kernel-probes/user-defined-probes/probe-lifecycle-management.md) — Allows users to list, trigger events for, and remove active instrumentation probes at runtime. ([source](https://github.com/btraceio/btrace/tree/develop/btrace-mcp-server))
- [Trace Exporters](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/execution-tracing-analysis/execution-tracing/trace-exporters.md) — Exports recorded execution event streams into standard formats for external visualization and performance analysis. ([source](https://github.com/btraceio/btrace/tree/develop/docs))
- [Stack Trace Capturers](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/observability-platforms/metric-performance-monitors/virtual-thread-monitors/thread-activity-monitors/stack-trace-capturers.md) — Records the sequence of method calls to diagnose execution paths via active thread stacks. ([source](https://github.com/btraceio/btrace/blob/develop/docs/QuickReference.md))
- [Object Allocation Profilers](https://awesome-repositories.com/f/system-administration-monitoring/object-allocation-profilers.md) — Samples object allocations and aggregates thread stacks to identify hot paths in the target environment. ([source](https://github.com/btraceio/btrace/blob/develop/CLAUDE.md))
- [Performance Distribution Analyzers](https://awesome-repositories.com/f/system-administration-monitoring/performance-distribution-analyzers.md) — Computes and prints statistical distributions of numeric values to analyze method execution latencies. ([source](https://github.com/btraceio/btrace/blob/develop/docs/QuickReference.md))
- [Safe Tracing Constraints](https://awesome-repositories.com/f/system-administration-monitoring/runtime-diagnostic-tracing/safe-tracing-constraints.md) — Enforces safety constraints on runtime scripts to prevent loops and allocations that could crash production applications.
- [Trace Event Filters](https://awesome-repositories.com/f/system-administration-monitoring/tracing-configuration/event-category-filters/trace-event-filters.md) — Provides conditional logic to filter trace events and reduce noise in the output. ([source](https://github.com/btraceio/btrace/blob/develop/docs/OnelinerGuide.md))

### Artificial Intelligence & ML

- [AI Agent Integrations](https://awesome-repositories.com/f/artificial-intelligence-ml/ai-agent-integrations.md) — Connects external AI agents and language models to live JVM runtimes using the Model Context Protocol. ([source](https://github.com/btraceio/btrace/tree/develop/docs))
- [Model Context Protocol Integrations](https://awesome-repositories.com/f/artificial-intelligence-ml/ai-assistant-integrations/model-context-protocol-integrations.md) — Connects Java virtual machines to AI assistants using the standardized Model Context Protocol for automated diagnostics.
- [MCP Protocol Integrations](https://awesome-repositories.com/f/artificial-intelligence-ml/external-tool-integrations/mcp-protocol-integrations.md) — Implements the Model Context Protocol to expose JVM diagnostic operations and tracing tools to AI assistants. ([source](https://github.com/btraceio/btrace/blob/develop/docs/BTraceTutorial.md))
- [Model Context Protocol Servers](https://awesome-repositories.com/f/artificial-intelligence-ml/model-context-protocol-servers.md) — Implements a Model Context Protocol server to expose JVM diagnostic tools to AI assistants.

### Part of an Awesome List

- [Runtime Process Attachers](https://awesome-repositories.com/f/awesome-lists/devtools/java-frameworks/java-agents/runtime-process-attachers.md) — Enables attaching to and modifying live JVM processes via instrumentation APIs for real-time monitoring.
- [JVM Profiling Tools](https://awesome-repositories.com/f/awesome-lists/devtools/jvm-profiling-tools.md) — Profiles JVM performance by measuring method latency and tracking object allocations.
- [Agent Packaging](https://awesome-repositories.com/f/awesome-lists/devtools/java-frameworks/java-agents/agent-packaging.md) — Packages tracing extensions into self-contained JAR files for deployment across distributed environments like Kubernetes.

### Development Tools & Productivity

- [Method Execution Trackers](https://awesome-repositories.com/f/development-tools-productivity/command-execution/method-execution-trackers.md) — Monitors the duration and output of specific Java methods at runtime using class and method patterns. ([source](https://github.com/btraceio/btrace/blob/develop/AGENTS.md))
- [Runtime Code Injection](https://awesome-repositories.com/f/development-tools-productivity/configuration-updates/real-time-runtime-updates/real-time-code-evaluation/runtime-code-injection.md) — Enables the insertion of tracing logic into a live process without requiring a restart. ([source](https://github.com/btraceio/btrace#readme))
- [Ad-hoc Trace Executions](https://awesome-repositories.com/f/development-tools-productivity/ad-hoc-trace-executions.md) — Runs short command-line scripts to print, count, or time events for rapid debugging. ([source](https://github.com/btraceio/btrace#readme))
- [Runtime Call-Stack Capturers](https://awesome-repositories.com/f/development-tools-productivity/call-stack-navigators/runtime-call-stack-capturers.md) — Captures active execution frames to identify the sequence of method calls leading to an event. ([source](https://github.com/btraceio/btrace/blob/develop/docs/OnelinerGuide.md))
- [Runtime Value Capture](https://awesome-repositories.com/f/development-tools-productivity/call-stack-navigators/runtime-call-stack-capturers/stack-return-capturers/runtime-value-capture.md) — Captures function arguments, return values, and execution durations during runtime instrumentation. ([source](https://github.com/btraceio/btrace/blob/develop/docs/QuickReference.md))
- [Isolated Service Interfaces](https://awesome-repositories.com/f/development-tools-productivity/development-extensions/isolated-service-interfaces.md) — Enables development of injectable service interfaces that maintain classloader isolation. ([source](https://github.com/btraceio/btrace/blob/develop/docs/BTraceExtensionDevelopmentGuide.md))
- [Instrumentation Extension Packaging](https://awesome-repositories.com/f/development-tools-productivity/package-registry-extensions/extension-packaging-tools/instrumentation-extension-packaging.md) — Bundles tracing logic into artifacts while automatically inferring the system permissions required for execution. ([source](https://github.com/btraceio/btrace/tree/develop/btrace-gradle-plugin))
- [Classloader Isolation](https://awesome-repositories.com/f/development-tools-productivity/plugin-systems/process-isolated-plugins/plugin-resource-context-isolation/classloader-isolation.md) — Uses isolated Java class loaders to prevent dependency conflicts between tracing extensions and the target application.

### Networking & Communication

- [JVM Agent Communication](https://awesome-repositories.com/f/networking-communication/remote-component-communication/jvm-agent-communication.md) — Establishes a high-performance binary communication link between a local client and a remote JVM agent. ([source](https://github.com/btraceio/btrace/blob/develop/CLAUDE.md))
- [Binary Communication Protocols](https://awesome-repositories.com/f/networking-communication/binary-communication-protocols.md) — Uses a high-performance binary serialization and transport protocol for communication between client and agent.
- [Custom Event Production](https://awesome-repositories.com/f/networking-communication/real-time-event-streams/jfr-event-streams/custom-event-production.md) — Creates custom recording events to leverage high-performance native Java Flight Recorder recording engines. ([source](https://github.com/btraceio/btrace/blob/develop/docs/BTraceTutorial.md))

### Operating Systems & Systems Programming

- [Instrumentation Safety Analysis](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/memory-safety-and-semantics/memory-safety/safety-analyzers/instrumentation-safety-analysis.md) — Analyzes instrumentation scripts at compile time to block unstable patterns like infinite loops or excessive allocations.
- [Event Aggregators](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/ebpf-tooling/event-aggregators.md) — Summarizes multiple execution events into totals and averages to identify performance patterns. ([source](https://github.com/btraceio/btrace/blob/develop/docs/README.md))
- [Startup Instrumentation](https://awesome-repositories.com/f/operating-systems-systems-programming/system-instrumentation-frameworks/android-instrumentation/dynamic-process-instrumentation/startup-instrumentation.md) — Allows agents to be pre-loaded at startup to capture events from the earliest stages of the application lifecycle. ([source](https://github.com/btraceio/btrace/wiki/Home))

### Security & Cryptography

- [Dynamic Instrumentation Injections](https://awesome-repositories.com/f/security-cryptography/dynamic-instrumentation-injections.md) — Injects tracing scripts into running JVM processes to modify and monitor behavior without restarts. ([source](https://github.com/btraceio/btrace#readme))

### Software Engineering & Architecture

- [Method Interception Proxies](https://awesome-repositories.com/f/software-engineering-architecture/method-interception-proxies.md) — Implements dynamic method interception to inject custom behavior into function calls without altering source code. ([source](https://github.com/btraceio/btrace/blob/develop/docs/BTraceTutorial.md))
- [Execution Trace Streams](https://awesome-repositories.com/f/software-engineering-architecture/event-driven-architectures/execution-trace-streams.md) — Routes execution data and structured spans from the instrumented process back to a client for real-time display. ([source](https://github.com/btraceio/btrace/blob/develop/AGENTS.md))
- [Exception Traceback Capture](https://awesome-repositories.com/f/software-engineering-architecture/exception-traceback-capture.md) — Captures full stack traces automatically when exceptions occur during JVM execution. ([source](https://github.com/btraceio/btrace/tree/develop/docs))
- [Plugin Installation and Management](https://awesome-repositories.com/f/software-engineering-architecture/integration-extensibility/extensibility/plugin-architectures/plugin-installation-utilities/plugin-installation-and-management.md) — Provides a system for installing and managing plugins that expand the agent's functionality. ([source](https://github.com/btraceio/btrace#readme))
- [Memory Usage Analysis](https://awesome-repositories.com/f/software-engineering-architecture/memory-usage-analysis.md) — Calculates the size of specific objects and monitors heap and non-heap consumption at runtime. ([source](https://github.com/btraceio/btrace/blob/develop/docs/QuickReference.md))
- [Latency Histograms](https://awesome-repositories.com/f/software-engineering-architecture/performance-reliability/performance-engineering/latency-optimization/latency-histograms.md) — Records duration distributions and statistics using histograms to track method execution timing. ([source](https://github.com/btraceio/btrace/blob/develop/docs/GettingStarted.md))
- [Thread-Local Storage](https://awesome-repositories.com/f/software-engineering-architecture/thread-local-storage.md) — Maintains ephemeral data associated with specific threads to share state across multiple instrumentation handlers.

### Testing & Quality Assurance

- [Method Performance Profiling](https://awesome-repositories.com/f/testing-quality-assurance/method-performance-profiling.md) — Measures execution time for specific methods and filters results to identify performance bottlenecks. ([source](https://github.com/btraceio/btrace/blob/develop/README.md))

### DevOps & Infrastructure

- [Agent Functionality Extensions](https://awesome-repositories.com/f/devops-infrastructure/release-automation/plugin-extensibility/plugin-extensible-runtimes/agent-functionality-extensions.md) — Supports extending the agent's capabilities via a stable API and isolated implementation modules. ([source](https://github.com/btraceio/btrace#readme))
- [Agent JAR Bundling](https://awesome-repositories.com/f/devops-infrastructure/self-hosted-applications/self-contained-bundles/agent-jar-bundling.md) — Packages instrumentation extensions into a single, self-contained JAR file for simplified deployment in distributed environments. ([source](https://github.com/btraceio/btrace/tree/develop/btrace-gradle-plugin))
