This commit is contained in:
2024-05-06 23:51:05 +02:00
parent 4bbbbb1660
commit c4d09fd7d4
4 changed files with 14 additions and 4 deletions

1
Cargo.lock generated
View File

@@ -338,6 +338,7 @@ dependencies = [
"prisma-client-rust",
"rand 0.8.5",
"sentry",
"sentry-tracing",
"serde",
"tokio",
"tower-http",

View File

@@ -19,6 +19,7 @@ tokio = { version = "1.37.0", features = ["full"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"]}
sentry-tracing = "0.32.3"
tower-http = { version = "0.5.2", features = ["trace"] }
axum = { version = "0.7.5", features = ["json"] }

View File

@@ -6,8 +6,10 @@ pub mod serializers;
pub mod views;
use sentry::{integrations::debug_images::DebugImagesIntegration, types::Dsn, ClientOptions};
use sentry_tracing::EventFilter;
use std::{net::SocketAddr, str::FromStr};
use tracing::info;
use tracing_subscriber::{filter, layer::SubscriberExt, util::SubscriberInitExt};
use crate::views::get_router;
@@ -22,9 +24,15 @@ async fn main() {
let _guard = sentry::init(options);
tracing_subscriber::fmt()
.with_target(false)
.compact()
let sentry_layer = sentry_tracing::layer().event_filter(|md| match md.level() {
&tracing::Level::ERROR => EventFilter::Event,
_ => EventFilter::Ignore,
});
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer().with_target(false))
.with(filter::LevelFilter::INFO)
.with(sentry_layer)
.init();
let addr = SocketAddr::from(([0, 0, 0, 0], 8080));

View File

@@ -25,7 +25,7 @@ where
.await
.unwrap();
let item = &result.hits.get(0).unwrap().result;
let item = &result.hits.first().unwrap().result;
item.get_id()
}