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 with_timestamp(self, timestamp: u64) -> Self
pub fn with_timestamp(self, timestamp: u64) -> Self
Sets the hostname for the event.
Sourcepub fn with_hostname(self, hostname: &'a str) -> Self
pub fn with_hostname(self, hostname: &'a str) -> Self
Sets the hostname for the event.
Sourcepub fn with_aggregation_key(self, aggregation_key: &'a str) -> Self
pub fn with_aggregation_key(self, aggregation_key: &'a str) -> Self
Sets the aggregation_key for the event.
Sourcepub fn with_priority(self, priority: EventPriority) -> Self
pub fn with_priority(self, priority: EventPriority) -> Self
Sets the priority for the event.
Sourcepub fn with_source_type_name(self, source_type_name: &'a str) -> Self
pub fn with_source_type_name(self, source_type_name: &'a str) -> Self
Sets the source_type_name for the event.
Sourcepub fn with_alert_type(self, alert_type: EventAlertType) -> Self
pub fn with_alert_type(self, alert_type: EventAlertType) -> Self
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