1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Structured access logging (Stage A observability, ADR 000009). Opt-in via `[observability]
//! access_log`; one `tracing` event per request on the `plecto::access` target — never `println!`
//! (bp-rust DECREE 8) — so the binary's JSON subscriber renders it as a structured line and an
//! operator can route the `plecto::access` target wherever they like. Disabled by default; the
//! per-request fields are only captured when it is on, so a disabled log costs nothing.
use IpAddr;
use Duration;
use RequestTrace;
/// The request fields captured (in `crate::proxy`) BEFORE the transaction core consumes the request
/// parts. Held only while the access log is enabled.
pub
/// The transaction outcome fields emitted on the access log.
pub
/// Emit one access-log event. Deliberately carries no secrets (no Authorization / Cookie value, and
/// the path without its query string — bp-rust): only method, authority, path, status, duration,
/// client IP and the connection scheme.
///
/// `client` is the address the transaction is attributed to — the connection peer, or the client
/// a declared front proxy named (ADR 000103). It is the same address the re-issued
/// `X-Forwarded-For` and the per-client rate-limit bucket use, so the log agrees with enforcement.
///
/// `trace_id` / `span_id` are emitted UNCONDITIONALLY, not only for sampled transactions (ADR
/// 000099): the ids join this line to whatever downstream sampling did keep, and for an unsampled
/// transaction the line is the only place the transaction is identifiable at all.
pub