pub struct SessionMetrics {Show 13 fields
pub total_llm_calls: u32,
pub total_tool_calls: u32,
pub total_input_tokens: u64,
pub total_output_tokens: u64,
pub estimated_context_tokens_peak: usize,
pub auto_compact_count: u32,
pub micro_compact_count: u32,
pub skill_loads: Vec<String>,
pub ttft_ms_per_call: Vec<u64>,
pub total_llm_elapsed_ms: u64,
pub total_tool_elapsed_ms: u64,
pub session_start_ms: u64,
pub session_end_ms: u64,
}Expand description
会话级性能/质量指标(session 结束时写入)
Fields§
§total_llm_calls: u32LLM API 调用次数(每轮 round 一次)
total_tool_calls: u32工具调用次数(tool_calls 数组元素总数)
total_input_tokens: u64真实 input tokens(来自 API usage,0 表示未获取到)
total_output_tokens: u64真实 output tokens(来自 API usage,0 表示未获取到)
estimated_context_tokens_peak: usize上下文 token 峰值(estimated_context_tokens 各轮最大值)
auto_compact_count: u32auto_compact(含 CompactTool)触发次数
micro_compact_count: u32micro_compact 触发次数
skill_loads: Vec<String>本次 session 加载的 skill 名称列表
ttft_ms_per_call: Vec<u64>每次 LLM 调用的首字延迟(毫秒);流式路径精确,fallback 路径为整个调用耗时
total_llm_elapsed_ms: u64LLM 调用总耗时(毫秒)—— 仅计算 LLM API 等待时间(含流式读取),不含工具执行时间
total_tool_elapsed_ms: u64工具执行总耗时(毫秒)—— 仅计算工具调用执行时间
session_start_ms: u64session 开始时间(epoch ms)
session_end_ms: u64session 结束时间(epoch ms)
Trait Implementations§
Source§impl Clone for SessionMetrics
impl Clone for SessionMetrics
Source§fn clone(&self) -> SessionMetrics
fn clone(&self) -> SessionMetrics
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionMetrics
impl Debug for SessionMetrics
Source§impl Default for SessionMetrics
impl Default for SessionMetrics
Source§fn default() -> SessionMetrics
fn default() -> SessionMetrics
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SessionMetrics
impl<'de> Deserialize<'de> for SessionMetrics
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>,
Deserialize this value from the given Serde deserializer. Read more
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<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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.