irontelemetry-rust/README.md

150 lines
4.3 KiB
Markdown

<p align="center">
<a href="https://irontelemetry.com">
<img src="https://irontelemetry.com/logo.png" alt="IronTelemetry" width="120" />
</a>
</p>
<h1 align="center">IronTelemetry SDK for Rust</h1>
<p align="center">
<strong>Error monitoring and crash reporting for Rust applications</strong>
</p>
<p align="center">
<a href="https://crates.io/crates/irontelemetry"><img src="https://img.shields.io/crates/v/irontelemetry.svg" alt="Crates.io"></a>
<a href="https://docs.rs/irontelemetry"><img src="https://docs.rs/irontelemetry/badge.svg" alt="Documentation"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
</p>
<p align="center">
<a href="https://irontelemetry.com">Website</a>
<a href="https://irontelemetry.com/docs">Documentation</a>
<a href="https://irontelemetry.com/docs/rust">Rust Guide</a>
<a href="https://git.marketally.com/ironservices">Git</a>
</p>
---
**IronTelemetry** helps you capture exceptions, track user journeys, and get actionable insights to fix issues faster. Built for developers who want simple, powerful error monitoring without the complexity.
## Features
- **Error Capture** - Capture errors with full context and metadata
- **Journey Tracking** - Understand what users did before an error occurred
- **Breadcrumbs** - Add context with custom breadcrumbs
- **Thread-Safe** - Safe for concurrent use with `Arc` and `RwLock`
- **Async Support** - Optional async feature for tokio/async-std
- **Zero-Copy** - Efficient memory usage with borrowed data where possible
## Installation
Add to your `Cargo.toml`:
```toml
[dependencies]
irontelemetry = "0.1"
```
For async support:
```toml
[dependencies]
irontelemetry = { version = "0.1", features = ["async"] }
```
## Quick Start
### Initialize the SDK
```rust
use irontelemetry::Client;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new("https://pk_live_xxx@irontelemetry.com")?;
// Your application code
Ok(())
}
```
### Capture Errors
```rust
if let Err(e) = do_something() {
client.capture_error(&*e);
}
// Or capture with message
client.capture_exception("RuntimeError", "Something went wrong");
```
### Track User Journeys
```rust
use irontelemetry::{Client, BreadcrumbCategory, create_journey_manager};
let journey_manager = create_journey_manager(&client);
let mut journey = journey_manager.start_journey("Checkout Flow");
journey.set_user("user-123", Some("user@example.com"), Some("John Doe"));
let result = journey.run_step("Validate Cart", BreadcrumbCategory::Business, || {
validate_cart()
});
if let Err(e) = result {
journey.fail(Some(&e.to_string()));
client.capture_exception("ValidationError", &e.to_string());
return Err(e.into());
}
journey.complete();
```
### Add Breadcrumbs
```rust
use irontelemetry::BreadcrumbCategory;
client.add_breadcrumb("User clicked checkout button", BreadcrumbCategory::Ui);
client.add_breadcrumb("Payment API called", BreadcrumbCategory::Http);
```
## Configuration
```rust
use irontelemetry::{Client, TelemetryOptions};
let options = TelemetryOptions::new("https://pk_live_xxx@irontelemetry.com")
.environment("production")
.app_version("1.2.3")
.sample_rate(1.0)
.debug(false);
let client = Client::with_options(options)?;
```
## Documentation
For complete documentation, visit [irontelemetry.com/docs](https://irontelemetry.com/docs).
## Other SDKs
| Platform | Package |
|----------|---------|
| JavaScript/TypeScript | [@ironservices/telemetry](https://git.marketally.com/ironservices/irontelemetry-js) |
| .NET | [IronTelemetry.Client](https://git.marketally.com/ironservices/irontelemetry-dotnet) |
| Python | [irontelemetry](https://git.marketally.com/ironservices/irontelemetry-python) |
| Go | [irontelemetry-go](https://git.marketally.com/ironservices/irontelemetry-go) |
| Java | [irontelemetry-java](https://git.marketally.com/ironservices/irontelemetry-java) |
## Support
- **Documentation**: [irontelemetry.com/docs](https://irontelemetry.com/docs)
- **Email**: dev@ironservices.io
- **Issues**: [git.marketally.com/ironservices/irontelemetry-rust/issues](https://git.marketally.com/ironservices/irontelemetry-rust/issues)
## License
MIT License - see [LICENSE](LICENSE) for details.