SGLang sgl-model-gateway/src/middleware.rs - the http_request span and its request_id correlation
repo
Fields
id
sources/w5e-sglang-gateway-middleware-spansPublisher
sgl-project
Kind
repo
Accessed
2026-10-05
notes
Read at main 2026-10-05. RequestSpan implements MakeSpan<B> and emits info_span!(target: "smg::otel-trace", "http_request", method, uri, version, request_id = Empty, status_code = Empty, latency = Empty, error = Empty, module = "smg"). Fields are declared Empty and filled later by the OnRequest/OnResponse handlers - the comment notes RequestIdLayer runs after TraceLayer, so request_id cannot be read at make_span time. sgl-model-gateway/src/routers/grpc/common/stages/request_execution.rs adds a second span, info_span!(target: "smg::otel-trace", "grpc_generate", request_id, model, mode), applied with .instrument(span).
Notes
Read at main 2026-10-05. RequestSpan implements MakeSpan<B> and emits info_span!(target: "smg::otel-trace", "http_request", method, uri, version, request_id = Empty, status_code = Empty, latency = Empty, error = Empty, module = "smg"). Fields are declared Empty and filled later by the OnRequest/OnResponse handlers - the comment notes RequestIdLayer runs after TraceLayer, so request_id cannot be read at make_span time. sgl-model-gateway/src/routers/grpc/common/stages/request_execution.rs adds a second span, info_span!(target: "smg::otel-trace", "grpc_generate", request_id, model, mode), applied with .instrument(span).
Cross-references
This record references no other records.