Skip to main content

Access

Struct Access 

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

One request in flight: what it was, and when it started.

Built at the top of the request’s thread and consumed by Access::finish after the response has been written, so the recorded duration covers the whole of the node’s work including the socket write.

Implementations§

Source§

impl Access

Source

pub fn start(request: &Request, counters: Arc<Counters>) -> Self

Captures the method and the path with its query string already removed.

The truncation happens here rather than at write time on purpose: a query string that never enters the struct cannot leave it, so no later edit to the formatting can leak a token that was passed as a query parameter.

Source

pub fn path(&self) -> &str

The path this access will record, query string already stripped.

Source

pub fn finish( self, log: Option<&RequestLog>, user: &str, outcome: &Result<(u16, u64)>, )

Records the finished request. outcome is the status and response body size when the response was written, or the I/O error that stopped it — a truncated response is exactly the thing an incident needs recorded, so it is logged rather than dropped.

A None log skips the line, which is what a node started without --request-log pays. The counters are bumped either way: they are what /metrics exports, and a node nobody can alert on is not an acceptable price for declining to keep a per-request record.

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

Source§

type Output = T

Should always be Self
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.