pub struct InputQueueScope { /* private fields */ }
Expand description

A metric scope wrapper that sends writes & flushes over a Rust sync channel. Commands are executed by a background thread.

Implementations§

Wrap new scopes with an asynchronous metric write & flush dispatcher.

Examples found in repository?
examples/bench_queue.rs (line 13)
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
fn main() {
    let bucket = AtomicBucket::new();
    // NOTE: Wrapping an AtomicBucket with a Queue probably useless, as it is very fast and performs no I/O.
    let queue = InputQueueScope::wrap(bucket.clone(), 10000);
    let event = queue.marker("a");
    let args = &mut args();
    args.next();
    let tc: u8 = u8::from_str(&args.next().unwrap()).unwrap();
    for _ in 0..tc {
        let event = event.clone();
        thread::spawn(move || {
            loop {
                // report some metric values from our "application" loop
                event.mark();
            }
        });
    }
    sleep(Duration::from_secs(5));
    bucket
        .flush_to(&Stream::write_to_stdout().metrics())
        .unwrap();
}

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Flush does nothing by default.
Define a generic metric of the specified type. It is preferable to use counter() / marker() / timer() / gauge() methods.
Define a Counter.
Define a Marker.
Define a Timer.
Define a Gauge.
Define a Level.
Return attributes of component.
Return attributes of component for mutation.
Clone the component and mutate its attributes at once.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.