Skip to main content

BudgetReport

Struct BudgetReport 

Source
pub struct BudgetReport { /* private fields */ }
Expand description

One budget a session drew on, with its own figures kept apart from the account’s.

Every figure here is a total over requests that really drew on this budget, so the only way to have one is to add those requests up. Session::budgets is that, and BudgetReport::record is where a request joins one: the request count, the spend, its three attributions and the account’s own readings all move together, from the same record, so a report cannot say it summarises nine requests while its attributions add up to four, or carry a REST budget’s figures under Budget::Graphql. The fields are read through the accessors below for exactly the reason RateLimit’s are: a hand-assembled set of totals would be a measurement of nothing, and this whole accounting exists because a number nobody measured was argued about instead.

Implementations§

Source§

impl BudgetReport

Source

pub const fn budget(&self) -> Budget

Which budget.

Source

pub const fn estimated(&self) -> Option<u64>

What a precondition estimated this session would spend against it before it started, when one estimated anything at all.

It is an estimate rather than a measurement, and the report says so where it prints it: what makes it worth carrying is that a reader can see how far the model was from what the session really spent.

Source

pub const fn requests(&self) -> usize

How many of this session’s requests drew on it.

Source

pub const fn attributed(&self) -> u64

What this session itself is attributed against it, summed per call.

Attributed rather than spent, for the reason Session::attributed gives: some of this figure is Basis::Modelled, GitHub’s documented one-point minimum, which is a lower bound and not a measurement. The four figures below are the same total split by basis, which is what says how much of it GitHub itself reported.

Source

pub const fn reported(&self) -> u64

How much of that GitHub itself reported.

Source

pub const fn modelled(&self) -> u64

How much of it is this repository’s one-point-per-call lower bound.

Source

pub const fn counted(&self) -> u64

How much of it is a count of requests against a budget metered in requests.

Source

pub const fn not_run(&self) -> usize

How many of its requests a rate limiter refused, so they never ran and are attributed nothing.

Source

pub const fn limit(&self) -> Option<u64>

The whole allowance, as GitHub’s own headers reported it.

Source

pub const fn used_by_the_account(&self) -> Option<u64>

What the account had spent, as GitHub’s own headers reported it. Not this session’s spend: other work draws on the same budget in the same window.

Source

pub const fn remaining_first_seen(&self) -> Option<u64>

The allowance remaining when this session’s first request against this budget was answered.

Source

pub const fn remaining_last_seen(&self) -> Option<u64>

The allowance remaining when its last one was.

Source

pub fn account_allowance_fall(&self) -> Option<u64>

How far the account’s remaining allowance fell while this session ran.

A fall rather than a movement, and the difference is not pedantry: an allowance that rose is the hourly window having reset mid-session, which is not a negative spend and answers zero here. Either way it is not this session’s spend, and the report says so where it prints it — this account is shared, so the difference between two readings of a shared counter measures the account.

Source

pub fn render(&self) -> String

This budget’s lines of the session report.

Trait Implementations§

Source§

impl Clone for BudgetReport

Source§

fn clone(&self) -> BudgetReport

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BudgetReport

Source§

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

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

impl Eq for BudgetReport

Source§

impl PartialEq for BudgetReport

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BudgetReport

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
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more