[][src]Struct libhoney::client::Client

pub struct Client<T: Sender> {
    pub transmission: T,
    // some fields omitted
}

Client represents an object that can create new builders and events and send them somewhere.

Fields

transmission: T

transmission mechanism for the client

Implementations

impl<T> Client<T> where
    T: Sender
[src]

pub fn new(options: Options, transmission: T) -> Self[src]

new creates a new Client with the provided Options and initialised Transmission.

Once populated, it auto starts the transmission background threads and is ready to send events.

pub fn add(&mut self, data: HashMap<String, Value>)[src]

add adds its data to the Client's scope. It adds all fields in a struct or all keys in a map as individual Fields. These metrics will be inherited by all builders and events.

pub fn add_field(&mut self, name: &str, value: Value)[src]

add_field adds a Field to the Client's scope. This metric will be inherited by all builders and events.

pub fn add_dynamic_field(&mut self, name: &str, func: DynamicFieldFunc)[src]

add_dynamic_field takes a field name and a function that will generate values for that metric. The function is called once every time a new_event() is created and added as a field (with name as the key) to the newly created event.

pub fn close(mut self: Self) -> Result<()>[src]

close waits for all in-flight messages to be sent. You should call close() before app termination.

pub fn flush(&mut self) -> Result<()>[src]

flush closes and reopens the Transmission, ensuring events are sent without waiting on the batch to be sent asyncronously. Generally, it is more efficient to rely on asyncronous batches than to call Flush, but certain scenarios may require Flush if asynchronous sends are not guaranteed to run (i.e. running in AWS Lambda) Flush is not thread safe - use it only when you are sure that no other parts of your program are calling Send

pub fn new_builder(&self) -> Builder[src]

new_builder creates a new event builder. The builder inherits any Dynamic or Static Fields present in the Client's scope.

pub fn new_event(&self) -> Event[src]

new_event creates a new event prepopulated with any Fields present in the Client's scope.

pub fn responses(&self) -> Receiver<Response>[src]

responses returns a receiver channel with responses

Trait Implementations

impl<T: Clone + Sender> Clone for Client<T>[src]

impl<T: Debug + Sender> Debug for Client<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Client<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Client<T> where
    T: Send
[src]

impl<T> Sync for Client<T> where
    T: Sync
[src]

impl<T> Unpin for Client<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Client<T> where
    T: UnwindSafe
[src]

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> Instrument for T[src]

impl<T> Instrument for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,