#tokio #riemann #client

rustmann

Rust/Tokio client for Riemann

22 unstable releases (6 breaking)

0.7.0 Jan 1, 2021
0.6.0 Dec 20, 2020
0.5.2 Dec 9, 2020
0.5.1 Oct 28, 2020
0.1.0 Oct 25, 2018

#45 in #tokio

45 downloads per month

MIT/Apache

23KB
554 lines

rustmann

Crates.io Docs Build Status GitHub Donate

A riemann client using tokio. This project is still in its early stage and API changes aggressively.

Usage

See examples and API docs.

Features & TODOs

  • TCP Client
  • TLS TCP Client (by enabling tls feature)
  • UDP Client
  • Report API (send_events)
  • Query API (send_query)
  • Event Builder API

License

MIT/Apache-2.0


lib.rs:

Rustmann

Rustmann is the rust client for riemann, a popular event aggregator and processor for distributed system.

This implementation is based on tokio and using async-await style API.

Features

  • Full async-await API
  • TCP/UDP/TLS transport support
  • Auto reconnect
  • Send and query API
  • EventBuilder
  • A usable Cli in example

Quick Start

use rustmann::{EventBuilder, RiemannClient, RiemannClientError, RiemannClientOptions};

#[tokio::main]
async fn main() -> Result<(), RiemannClientError> {
    // create client with default configuration (to localhost:5555)
    let mut client = RiemannClient::new(&RiemannClientOptions::default());

    // create a riemann event using evnet builder API
    let event = EventBuilder::new()
        .service("riemann_test")
        .state("ok")
        .metric_f(123.4)
        .build();

    // send event to server
    let response = client.send_events(vec![event]).await?;
    println!("{:?}", response);

    // query riemann
    let query_response = client.send_query("service = \"riemann_test\"").await?;
    println!("{:?}", query_response);
    Ok(())
}

See examples for more usage demo.

Dependencies

~4.5–8.5MB
~151K SLoC