pub struct Event {
pub seq: u64,
pub at: SystemTime,
pub timeout: Option<Duration>,
pub delay: Option<Duration>,
pub error: Option<String>,
pub attempt: Option<u64>,
pub task: Option<String>,
pub kind: EventKind,
}Expand description
Runtime event with optional metadata.
Carries information about task lifecycle, retries, errors, backoff delays, and timing.
§Fields
seq: Unique sequence number for ordering (monotonically increasing)at: Wall-clock timestamp (may go backwards due to NTP, use for logging only)monotonic: Monotonic timestamp (never goes backwards, use for interval measurements)kind: Event classificationtask,error,attempt,timeout,delay: Optional metadata
Fields§
§seq: u64Globally unique, monotonically increasing sequence number. Used to determine event ordering across async boundaries.
at: SystemTimeWall-clock timestamp (may go backwards, use for logging only).
timeout: Option<Duration>Task timeout (if relevant).
delay: Option<Duration>Backoff delay before retry (if relevant).
error: Option<String>Error message, if the event represents a failure.
attempt: Option<u64>Attempt count (starting from 1).
task: Option<String>Name of the task, if applicable.
kind: EventKindThe kind of event.
Implementations§
Source§impl Event
impl Event
Sourcepub fn now(kind: EventKind) -> Self
pub fn now(kind: EventKind) -> Self
Creates a new event of the given kind with current timestamps and next sequence number.
Sourcepub fn with_error(self, msg: impl Into<String>) -> Self
pub fn with_error(self, msg: impl Into<String>) -> Self
Attaches an error message.
Sourcepub fn with_timeout(self, d: Duration) -> Self
pub fn with_timeout(self, d: Duration) -> Self
Attaches a timeout duration.
Sourcepub fn with_delay(self, d: Duration) -> Self
pub fn with_delay(self, d: Duration) -> Self
Attaches a backoff delay.
Sourcepub fn with_attempt(self, n: u64) -> Self
pub fn with_attempt(self, n: u64) -> Self
Attaches an attempt count.
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.
Emitted when a subscriber’s queue is full and an event is dropped.
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.
Emitted when a subscriber panics during event processing.