pub struct Event {
pub seq: u64,
pub at: SystemTime,
pub timeout_ms: Option<u32>,
pub delay_ms: Option<u32>,
pub reason: Option<Arc<str>>,
pub attempt: Option<u32>,
pub task: Option<Arc<str>>,
pub kind: EventKind,
pub backoff_source: Option<BackoffSource>,
/* private fields */
}Expand description
Runtime event with optional metadata.
seq: monotonic global sequence for orderingat: wall-clock timestamp (for logs)- other optional fields are set depending on the
EventKind
Fields§
§seq: u64Globally unique, monotonically increasing sequence number.
at: SystemTimeWall-clock timestamp.
timeout_ms: Option<u32>Task timeout in milliseconds (compact).
delay_ms: Option<u32>Backoff delay before next attempt in milliseconds (compact).
reason: Option<Arc<str>>Human-readable reason (errors, overflow details, etc.).
attempt: Option<u32>Attempt count (starting from 1).
task: Option<Arc<str>>Name of the task, if applicable.
kind: EventKindEvent classification.
backoff_source: Option<BackoffSource>Source for backoff scheduling (success vs failure).
Implementations§
Source§impl Event
impl Event
Sourcepub fn new(kind: EventKind) -> Self
pub fn new(kind: EventKind) -> Self
Creates a new event of the given kind with current timestamp and next sequence number.
Sourcepub fn with_reason(self, reason: impl Into<Arc<str>>) -> Self
pub fn with_reason(self, reason: impl Into<Arc<str>>) -> Self
Attaches a human-readable reason.
Sourcepub fn with_timeout(self, d: Duration) -> Self
pub fn with_timeout(self, d: Duration) -> Self
Attaches a timeout duration (stored as milliseconds).
Sourcepub fn with_delay(self, d: Duration) -> Self
pub fn with_delay(self, d: Duration) -> Self
Attaches a backoff delay (stored as milliseconds).
Sourcepub fn with_attempt(self, n: u32) -> Self
pub fn with_attempt(self, n: u32) -> Self
Attaches an attempt count.
Sourcepub fn with_backoff_success(self) -> Self
pub fn with_backoff_success(self) -> Self
Marks that this backoff comes from a successful attempt.
Sourcepub fn with_backoff_failure(self) -> Self
pub fn with_backoff_failure(self) -> Self
Marks that this backoff comes from a failed attempt.
Sourcepub fn subscriber_overflow(
subscriber: &'static str,
reason: &'static str,
) -> Self
pub fn subscriber_overflow( subscriber: &'static str, reason: &'static str, ) -> Self
Creates a subscriber overflow event.
Sourcepub fn subscriber_panicked(subscriber: &'static str, info: String) -> Self
pub fn subscriber_panicked(subscriber: &'static str, info: String) -> Self
Creates a subscriber panic event.