Useful span names for incoming HTTP requests

Usually it's not possible to make span names dynamic, but the magic
otel.name attribute changes the span name in the OpenTelemetry tracing
backend.
This commit is contained in:
Lambda 2024-06-02 14:50:28 +00:00 committed by Charles Hall
parent 0b9e43cbdd
commit dd6cda4519
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF

View file

@ -168,7 +168,7 @@ async fn run_server() -> io::Result<()> {
request.uri().path()
};
tracing::info_span!("http_request", %path, method = %request.method())
tracing::info_span!("http_request", otel.name = path, %path, method = %request.method())
},
))
.layer(axum::middleware::from_fn(unrecognized_method))