statshouse

Crates.iostatshouse
lib.rsstatshouse
version0.1.1
created_at2026-01-15 21:55:01.090636+00
updated_at2026-01-15 22:01:37.214928+00
descriptionStatsHouse client library for Rust
homepagehttps://github.com/razmser/statshouse-rs
repositoryhttps://github.com/razmser/statshouse-rs
max_upload_size
id2047180
size32,779
Sergei Razmetov (razmser)

documentation

README

statshouse-rs

Rust client library for StatsHouse.

This repository is a Cargo workspace with:

  • statshouse/: the client library crate
  • xtask/: developer tooling (cargo x)

Usage

Add the dependency:

[dependencies]
statshouse = "0.1.0"

Send a counter metric (UDP by default):

use statshouse::{MetricBuilder, Transport};

fn main() {
    let mut transport = Transport::default();

    MetricBuilder::new(b"requests_total")
        .tag(b"env", b"staging")
        .tag(b"service", b"api")
        .write_count(&mut transport, 1.0, 0);
}

Send value metric over TCP:

use statshouse::{MetricBuilder, Transport};

fn main() {
    let mut transport = Transport::tcp("127.0.0.1:13337");

    MetricBuilder::new(b"latency_ms")
        .tag(b"env", b"staging")
        .write_values(&mut transport, &[12.3, 18.9, 7.4], 0.0, 0);

}

Use UDP explicitly:

use statshouse::{MetricBuilder, Transport};

fn main() {
    let mut transport = Transport::udp("127.0.0.1:13337");

    MetricBuilder::new(b"requests_total")
        .tag(b"env", b"staging")
        .write_count(&mut transport, 1.0, 0);
}

Development

Single command to run all checks: cargo x ci

License

MPL-2.0

TODO

  • Align __src_client_write_err tags with Go (env/app tags).
  • Re-resolve TCP addresses and retry queued batches on reconnect to match Go behavior.
Commit count: 0

cargo fmt