From dc71870cec2ce56c3e34aa3b2c5c44c3c051beb8 Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Thu, 26 Dec 2024 07:05:00 +0100 Subject: [PATCH] simplify sentry dependencies --- Cargo.lock | 6 ++---- Cargo.toml | 6 +----- src/bin/cratesfyi.rs | 5 ++++- src/utils/mod.rs | 2 +- src/web/mod.rs | 1 + 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7f57c1dfe..ff920c2b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1738,10 +1738,6 @@ dependencies = [ "rustwide", "semver", "sentry", - "sentry-anyhow", - "sentry-panic", - "sentry-tower", - "sentry-tracing", "serde", "serde_json", "serde_with", @@ -5717,11 +5713,13 @@ dependencies = [ "httpdate", "native-tls", "reqwest", + "sentry-anyhow", "sentry-backtrace", "sentry-contexts", "sentry-core", "sentry-debug-images", "sentry-panic", + "sentry-tower", "sentry-tracing", "tokio", "ureq", diff --git a/Cargo.toml b/Cargo.toml index deb9f4aec..79208548e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,11 +17,7 @@ exclude = [ ] [dependencies] -sentry = "0.35.0" -sentry-panic = "0.35.0" -sentry-tracing = "0.35.0" -sentry-tower = { version = "0.35.0", features = ["http"] } -sentry-anyhow = { version = "0.35.0", features = ["backtrace"] } +sentry = { version = "0.35.0", features = ["panic", "tracing", "tower-http", "anyhow", "backtrace"] } log = "0.4" tracing = "0.1.37" tracing-subscriber = { version = "0.3.16", default-features = false, features = ["ansi", "fmt", "json", "env-filter", "tracing-log"] } diff --git a/src/bin/cratesfyi.rs b/src/bin/cratesfyi.rs index 32871cdda..e3122fa7e 100644 --- a/src/bin/cratesfyi.rs +++ b/src/bin/cratesfyi.rs @@ -23,7 +23,10 @@ use docs_rs::{ use futures_util::StreamExt; use humantime::Duration; use once_cell::sync::OnceCell; -use sentry::TransactionContext; +use sentry::{ + integrations::panic as sentry_panic, integrations::tracing as sentry_tracing, + TransactionContext, +}; use tokio::runtime::{Builder, Runtime}; use tracing_log::LogTracer; use tracing_subscriber::{filter::Directive, prelude::*, EnvFilter}; diff --git a/src/utils/mod.rs b/src/utils/mod.rs index acbeebaf9..f7b717844 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -34,7 +34,7 @@ use std::{future::Future, thread, time::Duration}; pub(crate) fn report_error(err: &anyhow::Error) { // Debug-format for anyhow errors includes context & backtrace if std::env::var("SENTRY_DSN").is_ok() { - sentry_anyhow::capture_anyhow(err); + sentry::integrations::anyhow::capture_anyhow(err); error!(reported_to_sentry = true, "{err:?}"); } else { error!("{err:?}"); diff --git a/src/web/mod.rs b/src/web/mod.rs index 50d7fbdd9..c4280ee4b 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -51,6 +51,7 @@ use error::AxumNope; use page::TemplateData; use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS}; use semver::{Version, VersionReq}; +use sentry::integrations::tower as sentry_tower; use serde_with::{DeserializeFromStr, SerializeDisplay}; use std::{ borrow::{Borrow, Cow},