Skip to content

Commit aac499e

Browse files
goffrieConvex, Inc.
authored andcommitted
Tag request_id in Sentry before running http handlers (#36967)
GitOrigin-RevId: c814243c5a9d89c312ce83579fbf963d02a63cf7
1 parent 7b8abc3 commit aac499e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crates/common/src/http/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,10 @@ pub async fn stats_middleware<RM: RouteMapper>(
835835
Some(span_ctx) if *PROPAGATE_UPSTREAM_TRACES => Span::root(route.to_owned(), span_ctx),
836836
_ => Span::noop(),
837837
};
838+
839+
// Add the request_id to sentry
840+
sentry::configure_scope(|scope| scope.set_tag("request_id", &request_id));
841+
838842
let resp = next.run(req).in_span(root).await;
839843

840844
let client_version_s = client_version.to_string();
@@ -859,9 +863,6 @@ pub async fn stats_middleware<RM: RouteMapper>(
859863
let route = route_metric_mapper.map_route(route);
860864
let is_test = resolved_host.instance_name.starts_with("test-");
861865

862-
// Add the request_id to sentry
863-
sentry::configure_scope(|scope| scope.set_tag("request_id", request_id.clone()));
864-
865866
log_http_request(
866867
&client_version_s,
867868
&route,

0 commit comments

Comments
 (0)