-
-
Notifications
You must be signed in to change notification settings - Fork 331
Open
Labels
questionFurther information is requestedFurther information is requested
Description
A low cardinality path is required for creating a opentelemetry trace span, which is usually a uri template like /v1/users/{user_id}
. Is it possible to extract it from poem::Request
?
On axum, it can be extracted like this:
fn get_request_span_name(req: &Request) -> String {
let method = req.method().as_str();
if let Some(target) = req.extensions().get::<MatchedPath>() {
format!("{} {}", method, target.as_str())
} else {
method.to_string()
}
}
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested