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
impl Access
Sourcepub fn start(request: &Request, counters: Arc<Counters>) -> Self
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.
Sourcepub fn finish(
self,
log: Option<&RequestLog>,
user: &str,
outcome: &Result<(u16, u64)>,
)
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.