Struct statsd::client::Pipeline
[−]
[src]
pub struct Pipeline { /* fields omitted */ }
Methods
impl Pipeline
[src]
fn new() -> Pipeline
[src]
fn set_max_udp_size(&mut self, max_udp_size: usize)
[src]
Set max UDP packet size
use statsd::client::Pipeline; let mut pipe = Pipeline::new(); pipe.set_max_udp_size(128);
fn incr(&mut self, metric: &str)
[src]
Increment a metric by 1
use statsd::client::Pipeline; let mut pipe = Pipeline::new(); // Increment a given metric by 1. pipe.incr("metric.completed");
This modifies a counter with an effective sampling rate of 1.0.
fn decr(&mut self, metric: &str)
[src]
Decrement a metric by -1
use statsd::client::Pipeline; let mut pipe = Pipeline::new(); // Decrement a given metric by 1 pipe.decr("metric.completed");
This modifies a counter with an effective sampling rate of 1.0.
fn count(&mut self, metric: &str, value: f64)
[src]
Modify a counter by value
.
Will increment or decrement a counter by value
with
a sampling rate of 1.0.
use statsd::client::Pipeline; let mut pipe = Pipeline::new(); // Increment by 12 pipe.count("metric.completed", 12.0);
fn sampled_count(&mut self, metric: &str, value: f64, rate: f64)
[src]
Modify a counter by value
only x% of the time.
Will increment or decrement a counter by value
with
a custom sampling rate.
use statsd::client::Pipeline; let mut pipe = Pipeline::new(); // Increment by 4 50% of the time. pipe.sampled_count("metric.completed", 4.0, 0.5);
fn gauge(&mut self, metric: &str, value: f64)
[src]
Set a gauge value.
use statsd::client::Pipeline; let mut pipe = Pipeline::new(); // set a gauge to 9001 pipe.gauge("power_level.observed", 9001.0);
fn timer(&mut self, metric: &str, value: f64)
[src]
Send a timer value.
The value is expected to be in ms.
use statsd::client::Pipeline; let mut pipe = Pipeline::new(); // pass a duration value pipe.timer("response.duration", 10.123);
fn time<F>(&mut self, metric: &str, callable: F) where
F: Fn(),
[src]
F: Fn(),
Time a block of code.
The passed closure will be timed and executed. The block's duration will be sent as a metric.
use statsd::client::Pipeline; let mut pipe = Pipeline::new(); // pass a duration value pipe.time("response.duration", || { // Your code here. });
fn send(&mut self, client: &mut Client)
[src]
Send data along the UDP socket.