pub struct SessionMetrics {Show 16 fields
pub jsonl_save: TimingCounter,
pub jsonl_serialize: TimingCounter,
pub jsonl_io: TimingCounter,
pub jsonl_bytes: ByteCounter,
pub jsonl_queue_wait: TimingCounter,
pub sqlite_save: TimingCounter,
pub sqlite_append: TimingCounter,
pub sqlite_serialize: TimingCounter,
pub sqlite_bytes: ByteCounter,
pub sqlite_load: TimingCounter,
pub sqlite_load_meta: TimingCounter,
pub index_lock: TimingCounter,
pub index_upsert: TimingCounter,
pub index_list: TimingCounter,
pub index_reindex: TimingCounter,
pub append: TimingCounter,
/* private fields */
}Expand description
Centralized session hot-path metrics collector.
Covers four key phases identified in the PERF-3X measurement plan:
- Queueing: time between save request and actual IO start
- Serialization:
serde_jsonencoding time and output size - IO / Fsync: file write, flush, and atomic-rename time
- Index update: session-index upsert time
Plus additional breakdowns for SQLite paths and lock contention.
Fields§
§jsonl_save: TimingCounterTotal wall-clock time for a complete Session::save() JSONL call.
jsonl_serialize: TimingCounterTime spent in serde_json::to_writer for header + entries.
jsonl_io: TimingCounterTime spent in BufWriter::flush() + tempfile::persist().
jsonl_bytes: ByteCounterBytes written per JSONL save (header + entries).
jsonl_queue_wait: TimingCounterQueue wait: time from save() entry to IO thread start.
sqlite_save: TimingCounterTotal wall-clock time for save_session() (full rewrite).
sqlite_append: TimingCounterTotal wall-clock time for append_entries() (incremental append).
sqlite_serialize: TimingCounterTime spent serializing entries to JSON strings within SQLite save.
sqlite_bytes: ByteCounterTotal JSON bytes produced during SQLite save serialization.
sqlite_load: TimingCounterTotal wall-clock time for load_session().
sqlite_load_meta: TimingCounterTotal wall-clock time for load_session_meta().
index_lock: TimingCounterLock acquisition time in SessionIndex::with_lock().
index_upsert: TimingCounterTotal wall-clock time for upsert_meta() (including lock).
index_list: TimingCounterTotal wall-clock time for list_sessions() (including lock).
index_reindex: TimingCounterTotal wall-clock time for reindex_all().
append: TimingCounterTime for Session::append_message() and similar in-memory ops.
Implementations§
Source§impl SessionMetrics
impl SessionMetrics
Sourcepub fn start_timer<'a>(&'a self, counter: &'a TimingCounter) -> ScopedTimer<'a>
pub fn start_timer<'a>(&'a self, counter: &'a TimingCounter) -> ScopedTimer<'a>
Start a scoped timer for counter. If metrics are disabled, returns
a no-op timer that does nothing on drop.
Sourcepub fn record_bytes(&self, counter: &ByteCounter, bytes: u64)
pub fn record_bytes(&self, counter: &ByteCounter, bytes: u64)
Record bytes if metrics are enabled.
Sourcepub fn snapshot(&self) -> MetricsSnapshot
pub fn snapshot(&self) -> MetricsSnapshot
Produce a structured snapshot of all metrics.
Auto Trait Implementations§
impl !Freeze for SessionMetrics
impl RefUnwindSafe for SessionMetrics
impl Send for SessionMetrics
impl Sync for SessionMetrics
impl Unpin for SessionMetrics
impl UnsafeUnpin for SessionMetrics
impl UnwindSafe for SessionMetrics
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
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