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>
impl<'a> EventOptions<'a>
Sourcepub fn new() -> EventOptions<'a>
pub fn new() -> EventOptions<'a>
Creates a new EventOptions instance with all fields set to None.
Sourcepub fn with_timestamp(self, timestamp: u64) -> EventOptions<'a>
pub fn with_timestamp(self, timestamp: u64) -> EventOptions<'a>
Sets the hostname for the event.
Sourcepub fn with_hostname(self, hostname: &'a str) -> EventOptions<'a>
pub fn with_hostname(self, hostname: &'a str) -> EventOptions<'a>
Sets the hostname for the event.
Sourcepub fn with_aggregation_key(self, aggregation_key: &'a str) -> EventOptions<'a>
pub fn with_aggregation_key(self, aggregation_key: &'a str) -> EventOptions<'a>
Sets the aggregation_key for the event.
Sourcepub fn with_priority(self, priority: EventPriority) -> EventOptions<'a>
pub fn with_priority(self, priority: EventPriority) -> EventOptions<'a>
Sets the priority for the event.
Sourcepub fn with_source_type_name(
self,
source_type_name: &'a str,
) -> EventOptions<'a>
pub fn with_source_type_name( self, source_type_name: &'a str, ) -> EventOptions<'a>
Sets the source_type_name for the event.
Sourcepub fn with_alert_type(self, alert_type: EventAlertType) -> EventOptions<'a>
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>
impl<'a> Clone for EventOptions<'a>
Source§fn clone(&self) -> EventOptions<'a>
fn clone(&self) -> EventOptions<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more