Crate rotor_carbon [] [src]

The library allows to send data to carbon (also known as graphite)

Example

extern crate rotor;
extern crate rotor_tools;

use rotor_tools::loop_ext::LoopExt;

let loopinst = rotor::Loop::new(&rotor::Config::new()).instantiate(());
let sink = loopinst.add_and_fetch(|scope| {
    connect_ip("127.0.0.1:2003".parse().unwrap(), scope)
}).unwrap();

loopinst.run().unwrap();

// Then somewhere else:

{ // Note sender keeps lock on buffer for it's lifetime
    let sender = sink.sender();
    sender.add_u64("some.value", 1234);
}

If you need to format the metric name, use format_args! instead of format! as the former does not preallocate a buffer: snd.add_int_at( format_args!("servers.{}.metrics.{}", hostname, metric), metric_value, timestamp);

Structs

Sender

The sender object, which has convenience methods to send the data

Sink

This is a wrapper around the machinery to send data

Functions

connect_ip

Connect to the socket by IP address

Type Definitions

Fsm

A state machine object, just add in to the loop