Skip to main content

tokf_common/tracking/
types.rs

1#[derive(Debug)]
2pub struct TrackingEvent {
3    pub command: String,
4    pub filter_name: Option<String>,
5    pub filter_hash: Option<String>,
6    pub input_bytes: i64,
7    pub output_bytes: i64,
8    pub input_tokens_est: i64,
9    pub output_tokens_est: i64,
10    pub filter_time_ms: i64,
11    pub exit_code: i32,
12    /// True when `--prefer-less` chose the piped output over the filtered output.
13    pub pipe_override: bool,
14}
15
16#[derive(serde::Serialize)]
17pub struct GainSummary {
18    pub total_commands: i64,
19    pub total_input_tokens: i64,
20    pub total_output_tokens: i64,
21    pub tokens_saved: i64,
22    pub savings_pct: f64,
23    pub pipe_override_count: i64,
24    pub total_filter_time_ms: i64,
25    pub avg_filter_time_ms: f64,
26}
27
28#[derive(serde::Serialize)]
29pub struct DailyGain {
30    pub date: String,
31    pub commands: i64,
32    pub input_tokens: i64,
33    pub output_tokens: i64,
34    pub tokens_saved: i64,
35    pub savings_pct: f64,
36    pub pipe_override_count: i64,
37    pub total_filter_time_ms: i64,
38}
39
40#[derive(serde::Serialize)]
41pub struct FilterGain {
42    pub filter_name: String,
43    pub commands: i64,
44    pub input_tokens: i64,
45    pub output_tokens: i64,
46    pub tokens_saved: i64,
47    pub savings_pct: f64,
48    pub pipe_override_count: i64,
49    pub total_filter_time_ms: i64,
50    pub avg_filter_time_ms: f64,
51}