handle

Function handle 

Source
pub async fn handle<B>(
    dp: &Arc<DataPlane>,
    peer: IpAddr,
    req: Request<B>,
) -> Response<ProxyBody>
where B: Body<Data = Bytes> + Send + 'static, B::Error: Into<Box<dyn Error + Send + Sync>>,
Expand description

Handle one request against the current generation. Never panics; every failure path is a classified response. Generic over the request body so tests and alternative frontends can drive it with any streaming body. Takes the dataplane as an Arc reference: the response cache’s stale-while-revalidate path (DW-037) spawns background revalidations that need the dataplane to outlive the request.

Observability wrapper (DW-021): resolves the request ID (valid inbound X-Request-Id respected, else generated), opens the root request span, tracks the active-requests gauge, and — on completion — records the request counter/latency histogram, echoes X-Request-Id, and emits the (sampled) access-log line. Reserved paths (/healthz, /readyz, /metrics) count under the “unrouted” route label like 404s (they are not routes).