telemetry-kit

Getting Started

Get started with telemetry-kit - privacy-first telemetry for Rust applications

Welcome to telemetry-kit

telemetry-kit is a privacy-first, batteries-included telemetry toolkit for Rust applications. It makes adding telemetry to your Rust applications effortless with zero boilerplate and sensible defaults.

Key Features

  • 🚀 Auto-Sync - Background synchronization with configurable intervals
  • 🔒 Privacy-First - Anonymous user IDs, GDPR compliant, DO_NOT_TRACK support
  • 🛠️ CLI Tool - Manage telemetry from the command line
  • 📦 Self-Hostable - Production-ready server included
  • Zero-Config - Sensible defaults, minimal boilerplate
  • 🔄 Offline-Capable - SQLite buffering with automatic sync

Installation

Add telemetry-kit to your project

[dependencies]
telemetry-kit = "0.3"

Initialize telemetry in your application

use telemetry_kit::prelude::*;
 
#[tokio::main]
async fn main() -> Result<()> {
    // Initialize with just service name
    let telemetry = TelemetryKit::builder()
        .service_name("my-app")?
        .service_version(env!("CARGO_PKG_VERSION"))
        .build()?;
 
    // Your application code here
 
    Ok(())
}

Track events

// Track a command execution
telemetry.track_command("build", |event| {
    event
        .flag("--release")
        .duration_ms(1234)
        .success(true)
}).await?;
 
// Track a feature usage
telemetry.track_feature("authentication", |event| {
    event
        .method("oauth")
        .success(true)
}).await?;

What's Next?

Learn More

Quick Example

Here's a complete example showing local-only telemetry:

use telemetry_kit::prelude::*;
 
#[tokio::main]
async fn main() -> Result<()> {
    // Initialize telemetry (local-only)
    let telemetry = TelemetryKit::builder()
        .service_name("my-app")?
        .build()?;
 
    // Track events
    telemetry.track_command("process", |event| {
        event
            .flag("--input")
            .flag("--output")
            .success(true)
            .duration_ms(500)
    }).await?;
 
    // View stats
    let stats = telemetry.stats().await?;
    println!("Total events: {}", stats.total_events);
 
    Ok(())
}

Events are automatically stored locally in ~/.telemetry-kit/<service-name>.db.

Need Help?

On this page