Goal
Integrate Sentry Rust SDK into Rungu and CIRA backends, pointing DSN to self-hosted TrapFall instead of Sentry SaaS. Enable error capture, performance tracing, session tracking, and attachment support.
Context
Both Rungu and CIRA share identical stack: Rust/Axum 0.8, tracing + tracing-subscriber, custom ApiError (IntoResponse), SQLite/Postgres dual DB. The Sentry Rust SDK is MIT-licensed and works as a drop-in dependency.
Critical: #[tokio::main] Incompatibility
sentry::init() requires the Sentry client to exist before the tokio runtime is created. #[tokio::main] macro hides runtime construction — we must replace it with manual tokio::runtime::Builder:
// BEFORE (won't work with sentry::init)
#[tokio::main]
async fn main() { ... }
// AFTER (required for sentry::init)
fn main() {
let _guard = sentry::init((...));
let rt = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.unwrap();
rt.block_on(async { ... });
}
Tasks
4a. Dependencies
4b. Runtime refactor
4c. Tower middleware
4d. Testing
4e. Separate projects for dual-env
Depends On
Repos Affected
codecoradev/rungu
codecoradev/cira (or relevant repo)
Effort
~3-5 hours (mostly config + middleware wiring)
Sub-issues:
Goal
Integrate Sentry Rust SDK into Rungu and CIRA backends, pointing DSN to self-hosted TrapFall instead of Sentry SaaS. Enable error capture, performance tracing, session tracking, and attachment support.
Context
Both Rungu and CIRA share identical stack: Rust/Axum 0.8,
tracing+tracing-subscriber, customApiError(IntoResponse), SQLite/Postgres dual DB. The Sentry Rust SDK is MIT-licensed and works as a drop-in dependency.Critical:
#[tokio::main]Incompatibilitysentry::init()requires the Sentry client to exist before the tokio runtime is created.#[tokio::main]macro hides runtime construction — we must replace it with manualtokio::runtime::Builder:Tasks
4a. Dependencies
sentrycrate with features:tower,tower-http,tower-axum-matched-path,tracing,panic,anyhow,release-healthsentry_dsn: Option<String>,sentry_environment: Option<String>,sentry_traces_sample_rate: f64SENTRY_DSN4b. Runtime refactor
#[tokio::main]with manual runtime in main entry point_guard(sentry init guard) lives for the entire process lifetime4c. Tower middleware
NewSentryLayer::<Request<Body>>::new_from_top()layerSentryHttpLayer::new()(error capture).enable_transaction()for performance tracing (Phase 1 dependent)traces_sample_ratefrom config4d. Testing
4e. Separate projects for dual-env
https://key@trapfall:9090/rungu-prodhttps://key@trapfall:9090/rungu-devhttps://key@trapfall:9090/cira-prodhttps://key@trapfall:9090/cira-devDepends On
enable_transaction())Repos Affected
codecoradev/rungucodecoradev/cira(or relevant repo)Effort
~3-5 hours (mostly config + middleware wiring)
Sub-issues: