pub struct Accounting { /* private fields */ }Expand description
Every request one session sent, and what each cost.
It is on this crate’s ordinary code path — crate::GitHubProjectsSource records into
one at the single place a request leaves the crate, with no environment variable, no
feature and no build configuration to know about, because an instrument nobody switches
on measures nothing. It is constructible and recordable-into from outside the crate for
the other half of the same reason: a caller making its own calls beside this source’s —
the credentialed lane verifying a schema, sweeping residue, cleaning up — accounts for
the whole session rather than for this source’s share of it.
Implementations§
Source§impl Accounting
impl Accounting
Sourcepub fn estimate(&self, budget: Budget, cost: u64)
pub fn estimate(&self, budget: Budget, cost: u64)
Record what a caller estimated this session would spend against budget, before
it started.
An estimate is not an observation and is kept apart from one everywhere below: it is what a precondition decided on, and the point of carrying it here is that a report can put it beside what the session really spent, so a reader sees how far the model was from GitHub’s own figures rather than being told to trust it. The last estimate recorded for a budget is the one reported, because a precondition decides once.