[][src]Struct libhoney::Event

pub struct Event { /* fields omitted */ }

Event is used to hold data that can be sent to Honeycomb. It can also specify overrides of the config settings (client::Options).

Methods

impl Event[src]

pub fn new(options: &Options) -> Self[src]

new creates a new event with the passed ClientOptions

pub fn send<T: Sender>(&mut self, client: &mut Client<T>) -> Result<()>[src]

send dispatches the event to be sent to Honeycomb, sampling if necessary.

If you have sampling enabled (i.e. sample_rate >1), send will only actually transmit data with a probability of 1/sample_rate. No error is returned whether or not traffic is sampled, however, the Response sent down the response channel will indicate the event was sampled in the errors Err field.

Send inherits the values of required fields from ClientOptions. If any required fields are specified in neither ClientOptions nor the Event, send will return an error. Required fields are api_host, api_key, and dataset. Values specified in an Event override ClientOptions.

Once you send an event, any addition calls to add data to that event will return without doing anything. Once the event is sent, it becomes immutable.

pub fn send_presampled<T: Sender>(
    &mut self,
    client: &mut Client<T>
) -> Result<()>
[src]

send_presampled dispatches the event to be sent to Honeycomb.

Sampling is assumed to have already happened. send_presampled will dispatch every event handed to it, and pass along the sample rate. Use this instead of send() when the calling function handles the logic around which events to drop when sampling.

send_presampled inherits the values of required fields from Config. If any required fields are specified in neither Config nor the Event, send will return an error. Required fields are api_host, api_key, and dataset. Values specified in an Event override Config.

Once you send an event, any addition calls to add data to that event will return without doing anything. Once the event is sent, it becomes immutable.

pub fn set_sample_rate(&mut self, sample_rate: usize)[src]

Set options sample_rate on the event

pub fn set_timestamp(&mut self, timestamp: DateTime<Utc>)[src]

Set timestamp on the event

pub fn set_metadata(&mut self, metadata: Metadata)[src]

Set metadata on the event

pub fn metadata(&self) -> Metadata[src]

Get event metadata

pub fn fields(&self) -> HashMap<String, Value>[src]

Get event fields

pub fn get_fields_mut(&mut self) -> &mut HashMap<String, Value>[src]

Get event fields (mutable)

Trait Implementations

impl FieldHolder for Event[src]

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

add_field adds a field to the current (event/builder) fields

fn add_func<F>(&mut self, func: F) where
    F: Fn() -> Result<(String, Value)>, 
[src]

add_func iterates over the results from func (until Err) and adds the results to the event/builder fields

impl Clone for Event[src]

impl Debug for Event[src]

Auto Trait Implementations

impl Send for Event

impl Unpin for Event

impl Sync for Event

impl UnwindSafe for Event

impl RefUnwindSafe for Event

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

impl<T> From<T> for 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.

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

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

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

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

impl<T> Erased for T

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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