pub fn request_span(request: &Request) -> SpanExpand description
Build the per-request span, named "<METHOD> <route>" (e.g. GET /render)
instead of tower-http’s static "request", so traces read clearly in Monocle.
Pass it straight to tower-http’s make_span_with:
let layer = TraceLayer::new_for_http().make_span_with(monocle_agent::request_span);It relies on tower-http’s blanket MakeSpan implementation for
Fn(&Request) -> Span, so this crate depends on no tower-http version —
it works with whatever tower-http (0.5, 0.6, 0.7, …) your service already uses.
The span is created at INFO level (required so it passes the default filter
and reaches the OTLP exporter) with otel.kind = "server" and the
http.request.method / http.route semantic-convention fields. The dynamic
name is carried via the special otel.name field understood by
tracing-opentelemetry.