pub struct Carbon { /* private fields */ }Expand description
A structure that is used to submit values to carbon
Internally it uses a state machine to communicate to the underlying network connection(s)
Implementations§
Source§impl Carbon
impl Carbon
Sourcepub fn new(config: &Arc<Config>) -> (Carbon, Init)
pub fn new(config: &Arc<Config>) -> (Carbon, Init)
This creates an instance of the Carbon public interface and Init
structure that can be used to initialize a Proto instance
Sourcepub fn add_value_at<N, V>(&self, name: N, value: V, ts: SystemTime)
pub fn add_value_at<N, V>(&self, name: N, value: V, ts: SystemTime)
Add any numeric value for carbon with specific timestamp
§Example
ⓘ
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§
Auto Trait Implementations§
impl Freeze for Carbon
impl !RefUnwindSafe for Carbon
impl Send for Carbon
impl Sync for Carbon
impl Unpin for Carbon
impl !UnwindSafe for Carbon
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more