pub struct BatchFinding {
pub tag: String,
pub eligible_spend_usd: f64,
pub projected_batch_cost_usd: f64,
pub projected_savings_usd: f64,
pub share_of_spend_pct: f64,
pub request_count: u64,
}Expand description
A projected-savings finding for one batch-eligible tag segment.
Produced only for segments whose tag is in the configured eligible set AND
whose (provider, model) carries a batch rate in the catalog. The projection
is eligible_spend − projected_batch_cost, both computed from the catalog’s
real per-model batch rates.
Fields§
§tag: StringThe eligible tag this finding is for (e.g. "nightly-evals").
eligible_spend_usd: f64Current spend (USD) attributable to this eligible segment — summed
across every (provider, model) under the tag that has a catalog batch
rate (segments with no batch tier are excluded, since they can’t be
projected and aren’t batch-eligible at the provider).
projected_batch_cost_usd: f64Projected cost (USD) of the same traffic priced at the catalog’s Batch API rates.
projected_savings_usd: f64eligible_spend_usd − projected_batch_cost_usd, floored at 0. The
advisory headline (“≈ $X/mo saved at the Batch rate”).
eligible_spend_usd / total_spend_usd * 100 — what fraction of all
spend (across every segment considered) this eligible tag represents.
Drives the “tag=X is N% of spend and batch-eligible” phrasing.
request_count: u64Number of requests folded into this finding.
Implementations§
Source§impl BatchFinding
impl BatchFinding
Sourcepub fn discount_pct(&self) -> f64
pub fn discount_pct(&self) -> f64
The effective batch discount this finding realizes, as a percentage of
the eligible spend (savings / eligible_spend * 100). ~50 for providers
at the documented Batch-API rate; lower if the segment mixes models with
and without a batch tier. 0.0 when there is no eligible spend.
Trait Implementations§
Source§impl Clone for BatchFinding
impl Clone for BatchFinding
Source§fn clone(&self) -> BatchFinding
fn clone(&self) -> BatchFinding
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 BatchFinding
impl Debug for BatchFinding
Source§impl<'de> Deserialize<'de> for BatchFinding
impl<'de> Deserialize<'de> for BatchFinding
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>,
Source§impl PartialEq for BatchFinding
impl PartialEq for BatchFinding
Source§fn eq(&self, other: &BatchFinding) -> bool
fn eq(&self, other: &BatchFinding) -> bool
self and other values to be equal, and is used by ==.