From 76efb4f4707d188bd444e648cc0cc581b3504ff5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 11 Aug 2026 22:12:45 +0000 Subject: [PATCH 1/2] feat(deps): update rust crate sentry to 0.49.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1a33bf3..341c830 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -sentry = "0.48.0" +sentry = "0.49.0" rocket = { version = "0.5.0-rc.2", default-features = false } log = "0.4.17" serde = "1.0.137" From 833ce7b1a715d23b956f11db6535c249661cd670 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Aug 2026 21:16:09 +0300 Subject: [PATCH 2/2] feat(deps): update rust crate sentry to 0.49.0 & migrate to new API (#115) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Tests / build` is failing because `sentry` 0.49 changed `ClientOptions`: it is now non-exhaustive and no longer exposes `traces_sample_rate` / `traces_sampler` as struct fields. This PR updates initialization and related assertions to match the new API while keeping existing sampling behavior. - **Sentry options initialization migration** - Replaced `ClientOptions { ... }` struct-literal construction with `ClientOptions::new()` builder chaining. - Moved trace sampling configuration to builder methods: - custom sampler path → `.traces_sampler(...)` - fixed-rate path (`> 0`) → `.traces_sample_rate(...)` - Kept `before_send` logging and environment configuration intact. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Marti Raudsepp --- src/lib.rs | 27 ++++++++++++++------------- tests/tests.rs | 7 +++++-- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8bda8ce..d6381e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -83,19 +83,20 @@ impl RocketSentry { } fn init(&self, dsn: &str, traces_sample_rate: f32, environment: Cow<'static, str>) { - let guard = sentry::init(( - dsn, - ClientOptions { - before_send: Some(Arc::new(|event| { - info!("Sending event to Sentry: {}", event.event_id); - Some(event) - })), - traces_sample_rate, - traces_sampler: self.traces_sampler.clone(), - environment: Some(environment), - ..Default::default() - }, - )); + let mut client_options = ClientOptions::new() + .before_send(|event| { + info!("Sending event to Sentry: {}", event.event_id); + Some(event) + }) + .environment(environment); + + if let Some(traces_sampler) = self.traces_sampler.as_ref().map(Arc::clone) { + client_options = client_options.traces_sampler(move |ctx| traces_sampler(ctx)); + } else if traces_sample_rate > 0.0 { + client_options = client_options.traces_sample_rate(traces_sample_rate); + } + + let guard = sentry::init((dsn, client_options)); if guard.is_enabled() { // Tuck the ClientInitGuard in the fairing, so it lives as long as the server. diff --git a/tests/tests.rs b/tests/tests.rs index 43d31c4..e67ba97 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1,7 +1,7 @@ use figment::Figment; use rocket::Config; use rocket_sentry::RocketSentry; -use sentry::{Hub, TransactionContext}; +use sentry::{Hub, TracesSamplingStrategy, TransactionContext}; use std::sync::Arc; const SENTRY_DSN_CONFIG: (&str, &str) = ("sentry_dsn", "https://123@sentry.io/456"); @@ -48,7 +48,10 @@ async fn fairing_init_with_specific_traces_sampler() { .expect("Rocket failed to ignite"); let sentry_client = hub.client().unwrap(); - assert!(sentry_client.options().traces_sampler.is_some()); + assert!(matches!( + sentry_client.options().traces_sampling_strategy, + TracesSamplingStrategy::Function(_) + )); } async fn init_rocket_using_figment(figment: Figment) {