Struct dipstick::MultiInputScope
source · pub struct MultiInputScope { /* private fields */ }
Expand description
Dispatch metric values to a list of scopes.
Implementations§
source§impl MultiInputScope
impl MultiInputScope
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new multi scope dispatcher with no scopes.
Examples found in repository?
examples/clopwizard.rs (line 24)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
fn main() {
let one_minute = AtomicBucket::new();
one_minute.flush_every(Duration::from_secs(60));
let five_minutes = AtomicBucket::new();
five_minutes.flush_every(Duration::from_secs(300));
let fifteen_minutes = AtomicBucket::new();
fifteen_minutes.flush_every(Duration::from_secs(900));
let all_buckets = MultiInputScope::new()
.add_target(one_minute)
.add_target(five_minutes)
.add_target(fifteen_minutes)
.named("machine_name");
// send application metrics to aggregator
Proxy::default().target(all_buckets);
AtomicBucket::default_drain(Stream::write_to_stdout());
AtomicBucket::default_stats(stats_all);
loop {
COUNTER.count(17);
sleep(Duration::from_secs(3));
}
}
sourcepub fn add_target<IN: InputScope + Send + Sync + 'static>(
&self,
scope: IN
) -> Self
pub fn add_target<IN: InputScope + Send + Sync + 'static>(
&self,
scope: IN
) -> Self
Add a target to the dispatch list. Returns a clone of the original object.
Examples found in repository?
examples/clopwizard.rs (line 25)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
fn main() {
let one_minute = AtomicBucket::new();
one_minute.flush_every(Duration::from_secs(60));
let five_minutes = AtomicBucket::new();
five_minutes.flush_every(Duration::from_secs(300));
let fifteen_minutes = AtomicBucket::new();
fifteen_minutes.flush_every(Duration::from_secs(900));
let all_buckets = MultiInputScope::new()
.add_target(one_minute)
.add_target(five_minutes)
.add_target(fifteen_minutes)
.named("machine_name");
// send application metrics to aggregator
Proxy::default().target(all_buckets);
AtomicBucket::default_drain(Stream::write_to_stdout());
AtomicBucket::default_stats(stats_all);
loop {
COUNTER.count(17);
sleep(Duration::from_secs(3));
}
}
Trait Implementations§
source§impl Clone for MultiInputScope
impl Clone for MultiInputScope
source§fn clone(&self) -> MultiInputScope
fn clone(&self) -> MultiInputScope
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Default for MultiInputScope
impl Default for MultiInputScope
source§fn default() -> MultiInputScope
fn default() -> MultiInputScope
Returns the “default value” for a type. Read more
source§impl Flush for MultiInputScope
impl Flush for MultiInputScope
source§impl InputScope for MultiInputScope
impl InputScope for MultiInputScope
source§fn new_metric(&self, name: MetricName, kind: InputKind) -> InputMetric
fn new_metric(&self, name: MetricName, kind: InputKind) -> InputMetric
Define a generic metric of the specified type.
It is preferable to use counter() / marker() / timer() / gauge() methods.
source§impl WithAttributes for MultiInputScope
impl WithAttributes for MultiInputScope
source§fn get_attributes(&self) -> &Attributes
fn get_attributes(&self) -> &Attributes
Return attributes of component.
source§fn mut_attributes(&mut self) -> &mut Attributes
fn mut_attributes(&mut self) -> &mut Attributes
Return attributes of component for mutation.
source§fn with_attributes<F: Fn(&mut Attributes)>(&self, edit: F) -> Self
fn with_attributes<F: Fn(&mut Attributes)>(&self, edit: F) -> Self
Clone the component and mutate its attributes at once.