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)
14fn main() {
15 let one_minute = AtomicBucket::new();
16 one_minute.flush_every(Duration::from_secs(60));
17
18 let five_minutes = AtomicBucket::new();
19 five_minutes.flush_every(Duration::from_secs(300));
20
21 let fifteen_minutes = AtomicBucket::new();
22 fifteen_minutes.flush_every(Duration::from_secs(900));
23
24 let all_buckets = MultiInputScope::new()
25 .add_target(one_minute)
26 .add_target(five_minutes)
27 .add_target(fifteen_minutes)
28 .named("machine_name");
29
30 // send application metrics to aggregator
31 Proxy::default().target(all_buckets);
32 AtomicBucket::default_drain(Stream::write_to_stdout());
33 AtomicBucket::default_stats(stats_all);
34
35 loop {
36 COUNTER.count(17);
37 sleep(Duration::from_secs(3));
38 }
39}
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)
14fn main() {
15 let one_minute = AtomicBucket::new();
16 one_minute.flush_every(Duration::from_secs(60));
17
18 let five_minutes = AtomicBucket::new();
19 five_minutes.flush_every(Duration::from_secs(300));
20
21 let fifteen_minutes = AtomicBucket::new();
22 fifteen_minutes.flush_every(Duration::from_secs(900));
23
24 let all_buckets = MultiInputScope::new()
25 .add_target(one_minute)
26 .add_target(five_minutes)
27 .add_target(fifteen_minutes)
28 .named("machine_name");
29
30 // send application metrics to aggregator
31 Proxy::default().target(all_buckets);
32 AtomicBucket::default_drain(Stream::write_to_stdout());
33 AtomicBucket::default_stats(stats_all);
34
35 loop {
36 COUNTER.count(17);
37 sleep(Duration::from_secs(3));
38 }
39}
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.
Auto Trait Implementations§
impl Freeze for MultiInputScope
impl !RefUnwindSafe for MultiInputScope
impl Send for MultiInputScope
impl Sync for MultiInputScope
impl Unpin for MultiInputScope
impl !UnwindSafe for MultiInputScope
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Observe for Twhere
T: InputScope + WithAttributes,
impl<T> Observe for Twhere
T: InputScope + WithAttributes,
Source§impl<T> OnFlush for Twhere
T: Flush + WithAttributes,
impl<T> OnFlush for Twhere
T: Flush + WithAttributes,
Source§fn notify_flush_listeners(&self)
fn notify_flush_listeners(&self)
Notify registered listeners of an impending flush.
Source§impl<T> Prefixed for Twhere
T: WithAttributes,
impl<T> Prefixed for Twhere
T: WithAttributes,
Source§fn get_prefixes(&self) -> &NameParts
fn get_prefixes(&self) -> &NameParts
Returns namespace of component.
Source§fn add_prefix<S>(&self, name: S) -> T
👎Deprecated since 0.7.2: Use named() or add_name()
fn add_prefix<S>(&self, name: S) -> T
Append a name to the existing names. Return a clone of the component with the updated names.
Source§fn add_name<S>(&self, name: S) -> T
fn add_name<S>(&self, name: S) -> T
Append a name to the existing names. Return a clone of the component with the updated names.
Source§fn named<S>(&self, name: S) -> T
fn named<S>(&self, name: S) -> T
Replace any existing names with a single name.
Return a clone of the component with the new name.
If multiple names are required, add_name
may also be used.
Source§fn prefix_append<S: Into<MetricName>>(&self, name: S) -> MetricName
fn prefix_append<S: Into<MetricName>>(&self, name: S) -> MetricName
Append any name parts to the name’s namespace.
Source§fn prefix_prepend<S: Into<MetricName>>(&self, name: S) -> MetricName
fn prefix_prepend<S: Into<MetricName>>(&self, name: S) -> MetricName
Prepend any name parts to the name’s namespace.
Source§impl<T> ScheduleFlush for T
impl<T> ScheduleFlush for T
Source§fn flush_every(&self, period: Duration) -> CancelHandle
fn flush_every(&self, period: Duration) -> CancelHandle
Flush this scope at regular intervals.