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§fn clone(&self) -> SessionStats
fn clone(&self) -> SessionStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SessionStats
impl Debug for SessionStats
Source§impl Default for SessionStats
impl Default for SessionStats
Source§fn default() -> SessionStats
fn default() -> 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<SessionStats, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SessionStats, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for SessionStats
impl Serialize for SessionStats
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Forget for SessionStats
impl Freeze for SessionStatswhere
*const LeafNode<String, SessionDayCounts> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, SessionDayCounts)>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
impl Move for SessionStats
impl RefUnwindSafe for SessionStats
impl Send for SessionStatswhere
NodeRef<Owned, String, SessionDayCounts, LeafOrInternal>: Send,
BoxRaw<(String, SessionDayCounts)>: Send,
RawVecInner: Send,
impl Sync for SessionStatswhere
NodeRef<Owned, String, SessionDayCounts, LeafOrInternal>: Sync,
BoxRaw<(String, SessionDayCounts)>: Sync,
RawVecInner: Sync,
impl Unpin for SessionStats
impl UnsafeUnpin for SessionStatswhere
*const LeafNode<String, SessionDayCounts> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, SessionDayCounts)>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
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>,
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