[−][src]Struct libhoney::Event
Event
is used to hold data that can be sent to Honeycomb. It can also specify
overrides of the config settings (client::Options
).
Implementations
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]
&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.
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 Clone for Event
[src]
impl Debug for Event
[src]
impl FieldHolder for Event
[src]
fn add(&mut self, data: HashMap<String, Value>)
[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]
F: Fn() -> Result<(String, Value)>,
add_func iterates over the results from func (until Err) and adds the results to the event/builder fields
Auto Trait Implementations
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,