Skip to content

Commit 6c1c138

Browse files
committed
Auto merge of #4036 - rust-lang:renovate/sentry-conduit-0.x, r=Turbo87
Update Rust crate sentry-conduit to 0.3.0 [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [sentry-conduit](https://crates.io/crates/sentry-conduit) | dependencies | minor | `0.2.0` -> `0.3.0` | --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/rust-lang/crates.io).
2 parents 76eb3aa + 9ba4cdd commit 6c1c138

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

Cargo.lock

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ reqwest = { version = "0.11", features = ["blocking", "gzip", "json"] }
7474
scheduled-thread-pool = "0.2.0"
7575
semver = { version = "1.0.3", features = ["serde"] }
7676
sentry = { version = "0.23.0", features = ["tracing"] }
77-
sentry-conduit = "0.2.0"
77+
sentry-conduit = { version = "0.3.0", default-features = false }
7878
serde = { version = "1.0.0", features = ["derive"] }
7979
serde_json = "1.0.0"
8080
sha2 = "0.9"

src/middleware.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ pub fn build_middleware(app: Arc<App>, endpoints: RouteBuilder) -> MiddlewareBui
4444
let blocked_traffic = app.config.blocked_traffic.clone();
4545

4646
if env != Env::Test {
47+
m.add(SentryMiddleware::default());
4748
m.add(log_request::LogRequests::default());
48-
m.around(SentryMiddleware::default());
4949
}
5050

5151
if env == Env::Development {

src/router.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,17 @@ struct C(pub fn(&mut dyn RequestExt) -> EndpointResult);
151151

152152
impl Handler for C {
153153
fn call(&self, req: &mut dyn RequestExt) -> HandlerResult {
154-
// Allow blocking individual routes by their pattern through the `BLOCKED_ROUTES`
155-
// environment variable. This is not in a middleware because we need access to
156-
// `RoutePattern` before executing the response handler.
157154
if let Some(pattern) = req.extensions().find::<RoutePattern>() {
158-
if req.app().config.blocked_routes.contains(pattern.pattern()) {
155+
let pattern = pattern.pattern();
156+
157+
// Configure the Sentry `transaction` field *before* we handle the request,
158+
// but *after* the conduit-router has figured out which handler to use.
159+
sentry::configure_scope(|scope| scope.set_transaction(Some(pattern)));
160+
161+
// Allow blocking individual routes by their pattern through the `BLOCKED_ROUTES`
162+
// environment variable. This is not in a middleware because we need access to
163+
// `RoutePattern` before executing the response handler.
164+
if req.app().config.blocked_routes.contains(pattern) {
159165
return Ok(RouteBlocked.response().unwrap());
160166
}
161167
}

0 commit comments

Comments
 (0)