pub struct Ledger { /* private fields */ }Expand description
An append-only record of run costs.
Held in memory here; persisting it is the store crate’s job. Ordering is insertion order, which is also chronological as long as the Tower records a run when it finishes.
Implementations§
Source§impl Ledger
impl Ledger
Sourcepub fn summarise(&self, keep: impl Fn(&RunCost) -> bool) -> Summary
pub fn summarise(&self, keep: impl Fn(&RunCost) -> bool) -> Summary
Totals over the runs matching keep.
Sourcepub fn for_itinerary(&self, itinerary: &ItineraryId) -> Summary
pub fn for_itinerary(&self, itinerary: &ItineraryId) -> Summary
Totals for one chain.
Sourcepub fn since(&self, since: Timestamp) -> Summary
pub fn since(&self, since: Timestamp) -> Summary
Totals for runs that finished at or after since.
Sourcepub fn by_agent(&self) -> BTreeMap<AgentName, Summary>
pub fn by_agent(&self) -> BTreeMap<AgentName, Summary>
Totals per agent.
This is the breakdown that answers “what is expensive here”, which a single Fuel figure never could.
Sourcepub fn by_model(&self) -> BTreeMap<String, Summary>
pub fn by_model(&self) -> BTreeMap<String, Summary>
Totals per model, skipping runs whose model was never reported.
Sourcepub fn by_pipeline(&self) -> BTreeMap<PipelineName, Summary>
pub fn by_pipeline(&self) -> BTreeMap<PipelineName, Summary>
Totals per workflow, skipping runs no pipeline began.
The breakdown a factory with several pipelines actually needs. Per-agent totals cannot answer “what does the nightly sweep cost” once an agent belongs to more than one workflow, and in a real factory most of them do.