From 85a1b82ec66dff3ce697ef50c51caca7b1f0b142 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 1 Jul 2024 15:08:24 +0200 Subject: [PATCH] made sure that tracing and sentry play ball --- server/Cargo.lock | 2 ++ server/main-api/Cargo.toml | 2 +- server/main-api/src/main.rs | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/Cargo.lock b/server/Cargo.lock index 067547727..a0af301d8 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -3690,8 +3690,10 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "161283cfe8e99c8f6f236a402b9ccf726b201f365988b5bb637ebca0abbd4a30" dependencies = [ + "crc32fast", "once_cell", "rand", + "regex", "sentry-types", "serde", "serde_json", diff --git a/server/main-api/Cargo.toml b/server/main-api/Cargo.toml index eb0c05c1c..927726168 100644 --- a/server/main-api/Cargo.toml +++ b/server/main-api/Cargo.toml @@ -19,7 +19,7 @@ path = "src/main.rs" actix-web-prom = { version = "0.8.0", default-features = false, features = [] } tracing-subscriber = { version = "0.3.18",features = ["env-filter", "json", "fmt"]} tracing = "0.1.40" -sentry = { version = "0.34.0", features = ["backtrace","contexts","debug-images","panic","reqwest","rustls"] } +sentry = { version = "0.34.0", features = ["tracing","metrics","backtrace","contexts","debug-images","panic","reqwest","rustls"] } sentry-actix = "0.34.0" #serialisation diff --git a/server/main-api/src/main.rs b/server/main-api/src/main.rs index 5be299553..abd24b7aa 100644 --- a/server/main-api/src/main.rs +++ b/server/main-api/src/main.rs @@ -11,7 +11,6 @@ use sqlx::postgres::PgPoolOptions; use sqlx::prelude::*; use sqlx::PgPool; use tracing::{debug, error, info}; -use tracing_subscriber::fmt::Layer; mod calendar; mod details; @@ -60,6 +59,7 @@ fn connection_string() -> String { pub fn setup_logging() { use tracing_subscriber::filter::EnvFilter; + use tracing_subscriber::fmt::Layer; use tracing_subscriber::prelude::*; let default_level = if cfg!(any(debug_assertions, test)) { "debug" @@ -74,6 +74,7 @@ pub fn setup_logging() { let registry = tracing_subscriber::registry() .with(filter) + .with(sentry::integrations::tracing::layer()) .with(cfg!(not(any(debug_assertions, test))).then(|| Layer::default().json())) .with(cfg!(any(debug_assertions, test)).then(|| Layer::default().pretty())); tracing::subscriber::set_global_default(registry).unwrap();