pub struct Event { /* private fields */ }
Expand description
Event
is used to hold data that can be sent to Honeycomb. It can also specify
overrides of the config settings (client::Options
).
Implementations§
Source§impl Event
impl Event
Sourcepub fn send<T: Sender>(&mut self, client: &mut Client<T>) -> Result<()>
pub fn send<T: Sender>(&mut self, client: &mut Client<T>) -> Result<()>
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.
Sourcepub fn send_presampled<T: Sender>(
&mut self,
client: &mut Client<T>,
) -> Result<()>
pub fn send_presampled<T: Sender>( &mut self, client: &mut Client<T>, ) -> Result<()>
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.
Sourcepub fn set_sample_rate(&mut self, sample_rate: usize)
pub fn set_sample_rate(&mut self, sample_rate: usize)
Set options sample_rate on the event
Sourcepub fn set_timestamp(&mut self, timestamp: DateTime<Utc>)
pub fn set_timestamp(&mut self, timestamp: DateTime<Utc>)
Set timestamp on the event
Sourcepub fn set_metadata(&mut self, metadata: Metadata)
pub fn set_metadata(&mut self, metadata: Metadata)
Set metadata on the event
Sourcepub fn get_fields_mut(&mut self) -> &mut HashMap<String, Value>
pub fn get_fields_mut(&mut self) -> &mut HashMap<String, Value>
Get event fields (mutable)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)