pub struct SessionReplayEngine {
pub sessions: Vec<ReplaySession>,
pub max_sessions: usize,
}Expand description
Engine that records inference session events and allows structured replay and analysis.
Fields§
§sessions: Vec<ReplaySession>All recorded sessions, oldest-first.
max_sessions: usizeMaximum number of sessions to retain; oldest session is dropped when exceeded.
Implementations§
Source§impl SessionReplayEngine
impl SessionReplayEngine
Sourcepub fn new(max_sessions: usize) -> Self
pub fn new(max_sessions: usize) -> Self
Creates a new engine with the specified maximum session capacity.
Sourcepub fn record_event(&mut self, session_id: &str, event: ReplayEvent)
pub fn record_event(&mut self, session_id: &str, event: ReplayEvent)
Records event for the session identified by session_id.
If no session with that ID exists yet, a new one is created. When the
engine is already at capacity (max_sessions) and a new session must be
created, the oldest session is dropped first.
If the event is a SessionStart, the session’s started_at_secs is
initialised from the event’s timestamp_secs.
Sourcepub fn get_session(&self, session_id: &str) -> Option<&ReplaySession>
pub fn get_session(&self, session_id: &str) -> Option<&ReplaySession>
Returns a reference to the session with the given ID, if it exists.
Sourcepub fn filter_sessions(&self, filter: &ReplayFilter) -> Vec<&ReplaySession>
pub fn filter_sessions(&self, filter: &ReplayFilter) -> Vec<&ReplaySession>
Returns all sessions that match the given filter.
Sourcepub fn replay_queries(&self, session_id: &str) -> Vec<&ReplayEvent>
pub fn replay_queries(&self, session_id: &str) -> Vec<&ReplayEvent>
Returns only the Query and QueryResult events for the given session.
Sourcepub fn stats(&self) -> ReplayStats
pub fn stats(&self) -> ReplayStats
Computes aggregate statistics across all recorded sessions.
Sourcepub fn export_session(&self, session_id: &str) -> Option<String>
pub fn export_session(&self, session_id: &str) -> Option<String>
Exports a summary of the session as a JSON-like string.
Returns None if the session is not found.
Auto Trait Implementations§
impl Freeze for SessionReplayEngine
impl RefUnwindSafe for SessionReplayEngine
impl Send for SessionReplayEngine
impl Sync for SessionReplayEngine
impl Unpin for SessionReplayEngine
impl UnsafeUnpin for SessionReplayEngine
impl UnwindSafe for SessionReplayEngine
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more