pub struct SessionStats {Show 14 fields
pub total_tool_calls: u32,
pub total_tokens_saved: u64,
pub total_tokens_input: u64,
pub cache_hits: u32,
pub files_read: u32,
pub commands_run: u32,
pub intents_inferred: u32,
pub intents_explicit: u32,
pub unsaved_changes: u32,
pub security: SecurityCounts,
pub daily: BTreeMap<String, SessionDayCounts>,
pub client: Option<String>,
pub compose_calls: u64,
pub knowledge_written: u64,
}Expand description
Aggregate counters for the session: tool calls, token savings, cache hits.
Fields§
§total_tool_calls: u32§total_tokens_saved: u64§total_tokens_input: u64§cache_hits: u32§files_read: u32§commands_run: u32§intents_inferred: u32§intents_explicit: u32§unsaved_changes: u32§security: SecurityCountsSecurity events of this session (display counters; the audit trail is
the proof — see lean-ctx value).
daily: BTreeMap<String, SessionDayCounts>Tool calls and cache hits per UTC day (YYYY-MM-DD), so a session that
spans midnight still reports each day’s own counts (Cloud Cockpit
metrics). Bounded to the newest SESSION_DAYS_KEPT (120) days.
client: Option<String>The MCP client that drove this session (its handshake id, e.g.
claude-code); None until the first call of a known client.
compose_calls: u64ctx_compose calls, including those routed through ctx_call
(session.stats tools.compose). Left out of the record while zero,
so a session without one keeps the bytes it had before the counter.
knowledge_written: u64ctx_knowledge remembers that stored or reinforced a fact
(session.stats knowledge.written); a refused remember is not one.
Implementations§
Source§impl SessionStats
impl SessionStats
Sourcepub fn day_mut(&mut self, now: UtcDateTime) -> &mut SessionDayCounts
pub fn day_mut(&mut self, now: UtcDateTime) -> &mut SessionDayCounts
The counters of now’s UTC day, dropping the oldest day once more
than SESSION_DAYS_KEPT (120) are held.
Trait Implementations§
Source§impl Clone for SessionStats
impl Clone for SessionStats
Source§impl Debug for SessionStats
impl Debug for SessionStats
Source§impl Default for SessionStats
impl Default for SessionStats
Source§impl<'de> Deserialize<'de> for SessionStatswhere
SessionStats: Default,
impl<'de> Deserialize<'de> for SessionStatswhere
SessionStats: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Forget for SessionStats
impl Freeze for SessionStats
impl Move for SessionStats
impl RefUnwindSafe for SessionStats
impl Send for SessionStats
impl Sync for SessionStats
impl Unpin for SessionStats
impl UnsafeUnpin for SessionStats
impl UnwindSafe for SessionStats
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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