Struct telemetry::Service [] [src]

pub struct Service {
    // some fields omitted
}

Methods

impl Service

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.

fn new(is_active: bool) -> Service

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.

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

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.

fn set_active(&self, value: bool)

Make the service (in)active.

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

fn is_active(&self) -> bool

Trait Implementations

impl Drop for Service

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

fn drop(&mut self)