EventOptions

Struct EventOptions 

Source
pub struct EventOptions<'a> {
    pub timestamp: Option<u64>,
    pub hostname: Option<&'a str>,
    pub aggregation_key: Option<&'a str>,
    pub priority: Option<EventPriority>,
    pub source_type_name: Option<&'a str>,
    pub alert_type: Option<EventAlertType>,
}
Expand description

Configuration options for an Event.

EventOptions provides additional optional metadata that can be attached to an event, enabling greater flexibility and contextual information for event handling and monitoring systems.

§Example

use dogstatsd::{EventOptions, EventAlertType, EventPriority};

let options = EventOptions {
    timestamp: Some(1638480000),
    hostname: Some("localhost"),
    aggregation_key: Some("service_down"),
    priority: Some(EventPriority::Normal),
    source_type_name: Some("monitoring"),
    alert_type: Some(EventAlertType::Error),
};

Fields§

§timestamp: Option<u64>

Optional Unix timestamp representing the event time. The default is the current Unix epoch timestamp.

§hostname: Option<&'a str>

Optional hostname associated with the event.

§aggregation_key: Option<&'a str>

Optional key for grouping related events.

§priority: Option<EventPriority>

Optional priority level of the event, e.g., "low" or "normal".

§source_type_name: Option<&'a str>

Optional source type name of the event, e.g., "monitoring".

§alert_type: Option<EventAlertType>

Optional alert type for the event, e.g., "error", "warning", "info", "success". Default "info".

Implementations§

Source§

impl<'a> EventOptions<'a>

Source

pub fn new() -> EventOptions<'a>

Creates a new EventOptions instance with all fields set to None.

Source

pub fn with_timestamp(self, timestamp: u64) -> EventOptions<'a>

Sets the hostname for the event.

Source

pub fn with_hostname(self, hostname: &'a str) -> EventOptions<'a>

Sets the hostname for the event.

Source

pub fn with_aggregation_key(self, aggregation_key: &'a str) -> EventOptions<'a>

Sets the aggregation_key for the event.

Source

pub fn with_priority(self, priority: EventPriority) -> EventOptions<'a>

Sets the priority for the event.

Source

pub fn with_source_type_name( self, source_type_name: &'a str, ) -> EventOptions<'a>

Sets the source_type_name for the event.

Source

pub fn with_alert_type(self, alert_type: EventAlertType) -> EventOptions<'a>

Sets the alert_type for the event.

Trait Implementations§

Source§

impl<'a> Clone for EventOptions<'a>

Source§

fn clone(&self) -> EventOptions<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for EventOptions<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for EventOptions<'a>

Source§

fn default() -> EventOptions<'a>

Returns the “default value” for a type. Read more
Source§

impl<'a> Copy for EventOptions<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for EventOptions<'a>

§

impl<'a> RefUnwindSafe for EventOptions<'a>

§

impl<'a> Send for EventOptions<'a>

§

impl<'a> Sync for EventOptions<'a>

§

impl<'a> Unpin for EventOptions<'a>

§

impl<'a> UnwindSafe for EventOptions<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V