Getting Started with async-inspect
async-inspect is a powerful inspection and debugging tool for async Rust applications. Think of it as X-ray vision for your async codeβsee exactly what your futures are doing, where they're stuck, and why.
π― What is async-inspect?β
async-inspect provides:
- π Task Inspection: Real-time visibility into async task execution
- π Performance Analysis: Identify bottlenecks and slow operations
- π Deadlock Detection: Find circular dependencies before they bite
- π Execution Timeline: Visualize the async execution flow
- π Relationship Graphs: Understand task dependencies and communication
- π Ecosystem Integration: Works with Prometheus, OpenTelemetry, Grafana
Installationβ
Add async-inspect to your Cargo.toml:
[dependencies]
async-inspect = "0.0.1"
For TUI monitoring:
[dependencies]
async-inspect = { version = "0.0.1", features = ["cli"] }
Quick Startβ
1. Annotate Your Async Functionsβ
Use the #[async_inspect::trace] attribute to automatically instrument your async functions:
use async_inspect::prelude::*;
#[async_inspect::trace]
async fn fetch_user(id: u64) -> User {
let profile = fetch_profile(id).await;
let posts = fetch_posts(id).await;
User { profile, posts }
}
2. View Real-Time Statsβ
use async_inspect::prelude::*;
#[tokio::main]
async fn main() {
// Your async code here
my_async_function().await;
// Print summary
Reporter::global().print_summary();
}
3. Launch the TUI Monitor (Optional)β
cargo install async-inspect
async-inspect monitor
What's Next?β
- Core Concepts - Understand the fundamentals
- Examples - See async-inspect in action
- CLI Guide - Learn the command-line interface
- Production Use - Deploy with confidence
- Ecosystem Integration - Connect with your tools
Communityβ
Licenseβ
async-inspect is licensed under the MIT License.