Struct tk_carbon::Carbon
[−]
[src]
pub struct Carbon { /* fields omitted */ }
A structure that is used to submit values to carbon
Internally it uses a state machine to communicate to the underlying network connection(s)
Methods
impl Carbon
[src]
fn new(config: &Arc<Config>) -> (Carbon, Init)
[src]
This creates an instance of the Carbon public interface and Init
structure that can be used to initialize a Proto instance
fn add_value<N, V>(&self, name: N, value: V) where
N: Display,
V: Num + Display,
[src]
N: Display,
V: Num + Display,
Add any numeric value for carbon with current timestamp
Example
⚠Be careful when using this code, it's not being tested!
carbon.add_value("my.metric", 1); carbon.add_value( format_args!("metrics.{host}.cpu", host), 27);
Panics
- When either name or value can't be formatted (Display'd)
- When formatted name contains a whitespace or a newline
fn add_value_at<N, V>(&self, name: N, value: V, ts: SystemTime) where
N: Display,
V: Num + Display,
[src]
N: Display,
V: Num + Display,
Add any numeric value for carbon with specific timestamp
Example
⚠Be careful when using this code, it's not being tested!
let timestamp = SystemTime::now(); carbon.add_value_at("my.metric", 1, timestamp); carbon.add_value_at( format_args!("metrics.{host}.cpu", host), 27, timestamp);
Panics
- When either name or value can't be formatted (Display'd)
- When formatted name contains a whitespace or a newline
- If timestamp is smaller than UNIX_EPOCH
Trait Implementations
impl Clone for Carbon
[src]
fn clone(&self) -> Carbon
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more