UsageEvent

Struct UsageEvent 

Source
pub struct UsageEvent {
Show 21 fields pub session_id: String, pub command: String, pub path: Option<String>, pub query: Option<String>, pub estimated_tokens_without_projectatlas: Option<usize>, pub estimated_tokens_with_projectatlas: Option<usize>, pub estimated_tokens_saved: Option<isize>, pub token_savings_bucket: String, pub provider: String, pub model: String, pub tokenizer_backend: String, pub accuracy: String, pub baseline_kind: String, pub confidence: String, pub calculation_trace: String, pub accounting_layer: String, pub estimate_method: String, pub denominator_kind: String, pub baseline_identity: String, pub baseline_fingerprint: String, pub dedupe_scope: String,
}
Expand description

Token savings event for a funnel command.

Fields§

§session_id: String

Optional caller-visible compatibility label, distinct from runtime identity.

§command: String

Command or tool name.

§path: Option<String>

Optional path affected by the command.

§query: Option<String>

Optional query text.

§estimated_tokens_without_projectatlas: Option<usize>

Baseline token estimate without ProjectAtlas.

§estimated_tokens_with_projectatlas: Option<usize>

Actual token estimate with ProjectAtlas.

§estimated_tokens_saved: Option<isize>

Estimated token delta.

§token_savings_bucket: String

Savings bucket used for reporting hard evidence separately from modeled savings.

§provider: String

Provider used for token counting.

§model: String

Model used for token counting.

§tokenizer_backend: String

Tokenizer or API backend used for token counting.

§accuracy: String

Accuracy level for the token count.

§baseline_kind: String

Baseline scenario used for the without-ProjectAtlas estimate.

§confidence: String

Confidence level for the baseline scenario.

§calculation_trace: String

Compact calculation trace.

§accounting_layer: String

Accounting layer used to separate measured deltas from modeled avoidance.

§estimate_method: String

Token estimate method used for this event.

§denominator_kind: String

Denominator represented by the baseline estimate.

§baseline_identity: String

Stable modeled-baseline identity for deduplication.

§baseline_fingerprint: String

Stable modeled-baseline fingerprint for deduplication.

§dedupe_scope: String

Scope used when deduplicating modeled avoidance.

Implementations§

Source§

impl UsageEvent

Source

pub fn is_observed(&self) -> bool

Return whether this event represents an observed before/after source comparison.

Source

pub fn is_modeled(&self) -> bool

Return whether this event represents modeled navigation avoidance.

Source

pub fn is_observed_file_read_replacement(&self, baseline_tokens: usize) -> bool

Return whether this observed event is strong whole-file replacement evidence.

Source

pub fn is_modeled_file_read_avoidance(&self, baseline_tokens: usize) -> bool

Return whether this modeled event is strong whole-file avoidance evidence.

Source

pub fn report_accounting_layer(&self) -> &str

Return the normalized accounting layer used by bucket reports.

Source

pub fn report_denominator_kind(&self) -> &str

Return the normalized denominator used by bucket reports.

Source

pub fn report_dedupe_scope(&self) -> &str

Return the normalized deduplication scope used by bucket reports.

Source

pub fn effective_baseline_identity(&self) -> Cow<'_, str>

Return the modeled baseline identity, including the legacy fallback.

Source

pub fn effective_baseline_fingerprint(&self) -> Cow<'_, str>

Return the modeled baseline fingerprint, including the legacy fallback.

Source

pub fn modeled_baseline_key(&self) -> [u8; 32]

Return the fixed collision-resistant key for one modeled baseline witness.

Trait Implementations§

Source§

impl Clone for UsageEvent

Source§

fn clone(&self) -> UsageEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UsageEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for UsageEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for UsageEvent

Source§

fn eq(&self, other: &UsageEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for UsageEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for UsageEvent

Source§

impl StructuralPartialEq for UsageEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,