Closed horseinthesky closed 6 months ago
At the moment addition of TraceLayer provides you no ability to name your span
TraceLayer
let app = Router::new() .route("/api/devices", get(devices)) .layer( TraceLayer::new_for_http() .make_span_with(DefaultMakeSpan::new().include_headers(true)), ) .route( "/metrics", get(|| async { "metrics" }), );
As the result all spans are named request.
request
It would be nice see method+endpoint uri instead. Something like GET /api/devices. This would simplify working with spans on a collector side.
GET /api/devices
I'm very new to Rust. If I'm not mistaken this is the place where request name code from https://github.com/tower-rs/tower-http/blob/main/tower-http/src/trace/make_span.rs#L84-L101
Not sure how to achieve this.
Feature Request
At the moment addition of
TraceLayer
provides you no ability to name your spanAs the result all spans are named
request
.Motivation
It would be nice see method+endpoint uri instead. Something like
GET /api/devices
. This would simplify working with spans on a collector side.Proposal
I'm very new to Rust. If I'm not mistaken this is the place where
request
name code from https://github.com/tower-rs/tower-http/blob/main/tower-http/src/trace/make_span.rs#L84-L101Not sure how to achieve this.