detritus

Crash reports and logs, collected on your own server

A lightweight receiver for small Rust projects, built from a protocol crate, an OTLP/gRPC and multipart crash server, and a client that spools both when the network is down.

OTLP logs over gRPC

The receiver implements opentelemetry.proto.collector.logs.v1.LogsService.Export, so an existing OpenTelemetry client ships logs with no custom wire protocol. Batches are appended as NDJSON per project, source and day.

Crash uploads with their artifacts

Applications POST multipart to /v1/crashes: JSON crash metadata, the binary dump, and optional attach parts. Dumps land in a content-addressed SHA-256 blob store, and the response reports the blob hash and whether the upload deduplicated.

A client that survives an outage

The detritus-client tracing layer spools protobuf log batches to a queue directory and retries them with bounded attempts, while the panic hook writes a crash entry to disk before shipping it. An outage does not lose the report that explains it.

One port, self-hosted

A single axum router with tonic routes mounted on it serves gRPC and HTTP on port 4317, as the detritusd binary or embedded in your own process. Token files hold salted Argon2id hashes rather than raw tokens, and a NixOS module wires the file from a secret.

Send from a Rust application

The client crate is a tracing layer plus an optional panic hook. Point the builder at the receiver, give it a token and a source identity, and every event on the subscriber goes out over OTLP/gRPC; the queue directory holds anything it could not send yet.

use detritus::{CompressionEncoding, Layer, SourceId};
use secrecy::SecretString;
use tracing_subscriber::{Registry, layer::SubscriberExt};
use url::Url;
use uuid::Uuid;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let layer = Layer::builder()
        .endpoint(Url::parse("http://127.0.0.1:4317")?)
        .token(SecretString::from(std::env::var("DETRITUS_TOKEN")?))
        .compression(CompressionEncoding::Zstd)
        .source(SourceId {
            project: "my-game".to_owned(),
            platform: "linux".to_owned(),
            version: "0.1.0".to_owned(),
            install_id: Uuid::nil(),
        })
        .queue_dir("./detritus-spool".into())
        .build()?;

    let subscriber = Registry::default().with(layer);
    tracing::subscriber::with_default(subscriber, || {
        tracing::info!("shipped to the local receiver");
    });

    Ok(())
}

Runnable versions live in the workspace: cargo run --example install_layer -p detritus-client, and cargo run --example embed_server -p detritus-server for the receiver side.

Quick start

Install the receiver, start it with a token file, then check the listener answers. The quick start in the documentation covers the token file shape and a first crash upload.

Open full install guide
From a checkout, with tokens.toml holding Argon2id hashes Run it locally

Best fit for this setup.

cargo run -p detritus-server -- --bind 127.0.0.1:4317 --data-dir ./detritus-data --tokens-config ./tokens.toml
Open guide
Rust 1.88 or newer, compiles the receiverBuild from crates.io
cargo install detritus-server
Open guide
Returns 204 No Content when the receiver is upCheck the listener
curl -i http://127.0.0.1:4317/healthz
Open guide