Skip to content

Commit a8c1a31

Browse files
goffrieConvex, Inc.
authored andcommitted
Remove MatchedPath extension (#42916)
GitOrigin-RevId: c589423c7413ca7b6c4f9d5cb0ee004c0406c10c
1 parent 74d18f9 commit a8c1a31

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

crates/common/src/http/mod.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use axum::{
3333
connect_info::IntoMakeServiceWithConnectInfo,
3434
rejection::ExtensionRejection,
3535
FromRequestParts,
36-
MatchedPath,
3736
OptionalFromRequestParts,
3837
State,
3938
},
@@ -827,7 +826,7 @@ pub async fn stats_middleware<RM: RouteMapper>(
827826
let method = req.method().clone();
828827
// tag with the route. 404s lack matched query path - and the
829828
// uri is generally unhelpful for metrics aggregation, so leave it out there.
830-
let mut route = matched_path
829+
let route = matched_path
831830
.map(|r| r.as_str().to_owned())
832831
.unwrap_or("unknown".to_owned());
833832

@@ -849,19 +848,6 @@ pub async fn stats_middleware<RM: RouteMapper>(
849848

850849
let client_version_s = client_version.to_string();
851850

852-
// Since conductor is using a fallback handler which creates a new sub-router
853-
// within the handler, we can't extract the matched path from the request
854-
// extension. So we extract it from the response extension.
855-
// This allows it to participate in log_http_request, though it sadly won't
856-
// participate in the root span.
857-
//
858-
// We can probably work around this with some effort by switching from State
859-
// to Extension in axum and using a layer instead of a multiplex handler.
860-
let matched_path = resp.extensions().get::<Option<MatchedPath>>();
861-
if let Some(Some(matched_path)) = matched_path {
862-
route = matched_path.as_str().to_owned();
863-
}
864-
865851
if route == "unknown" {
866852
tracing::info!("stats_middleware: matched_path is None, uri: {}", uri);
867853
}

0 commit comments

Comments
 (0)