Struct telemetry::Service[][src]

pub struct Service { /* fields omitted */ }

Implementations

impl Service[src]

The Telemetry service.

The service is in charge of maintaining the data recorded by the histograms. Each application using telemetry needs one instance of the service (or more, but this should seldom be necessary). The data is stored and processed in a dedicated background thread and the memory is recollected only when the service is dropped.

Panics

The service will panic if an attempt is made to register two histograms with the same key.

pub fn new(is_active: bool) -> Service[src]

Create a new instance of the service.

This immediately launches the thread owning the data.

If is_active is false, the service will immediately accept records. Otherwise, the service will only start recording once set_active(true) has been called.

pub fn to_json(
    &self,
    what: Subset,
    format: SerializationFormat,
    sender: Sender<Json>
)
[src]

Serialize all histograms as json, in a given format.

Panics

The service will panic if the sender is closed by the time serialization is complete.

pub fn set_active(&self, value: bool)[src]

Make the service (in)active.

Any data recorded on a histogram while the service is inactive will be ignored.

pub fn is_active(&self) -> bool[src]

Trait Implementations

impl Drop for Service[src]

Upon death of the service, terminate the thread and recollect all owned memory.

Auto Trait Implementations

impl !RefUnwindSafe for Service

impl Send for Service

impl !Sync for Service

impl Unpin for Service

impl !UnwindSafe for Service

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.