MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / make_request_span

Function make_request_span

crates/openshell-server/src/multiplex.rs:59–82  ·  view source on GitHub ↗

Build a tracing span for an inbound request, recording the `request_id` header (set by [`UuidRequestId`] or supplied by the client).

(req: &Request<B>)

Source from the content-addressed store, hash-verified

57/// Build a tracing span for an inbound request, recording the `request_id`
58/// header (set by [`UuidRequestId`] or supplied by the client).
59fn make_request_span<B>(req: &Request<B>) -> Span {
60 let path = req.uri().path();
61 let request_id = req
62 .headers()
63 .get("x-request-id")
64 .and_then(|v| v.to_str().ok())
65 .unwrap_or("-");
66
67 if matches!(path, "/health" | "/healthz" | "/readyz") {
68 tracing::debug_span!(
69 "request",
70 method = %req.method(),
71 path,
72 request_id,
73 )
74 } else {
75 tracing::info_span!(
76 "request",
77 method = %req.method(),
78 path,
79 request_id,
80 )
81 }
82}
83
84/// Log response status and latency within the request span.
85fn log_response<B>(res: &Response<B>, latency: Duration, _span: &Span) {

Callers 1

Calls 2

pathMethod · 0.80
getMethod · 0.45

Tested by 1