Parent: #234 · Blocked by: #248, #249
Scope
Wire Sentry tower middleware into the Axum router for both Rungu and CIRA. Phase 1: errors only (no transactions — TrapFall doesn't support them yet).
Middleware Stack (bottom to top)
[SentryTracingLayer] ← bridge tracing events → Sentry
[SentryHttpLayer] ← capture HTTP errors + context
[app router] ← existing Axum routes
Implementation
Rungu (rungud/src/server.rs)
use sentry_tower::NewSentryLayer;
use sentry_tower::SentryHttpLayer;
let app = Router::new()
.route("/", get(index))
// ... existing routes
.layer(
ServiceBuilder::new()
.layer(NewSentryLayer::<Request<Body>>::new_from_top())
.layer(SentryHttpLayer::new()) // errors only (no .enable_transaction())
);
CIRA
Same pattern — insert in the main router builder.
Tracing Bridge (optional but recommended)
// In the tracing-subscriber setup, BEFORE Sentry init:
let sentry_layer = sentry_tracing::layer();
let subscriber = tracing_subscriber::Registry::default()
.with(tracing_subscriber::EnvFilter::new(
std::env::var("RUST_LOG").unwrap_or_else(|_| "info".into())
))
.with(sentry_layer); // bridges tracing::error! → Sentry events
tracing::subscriber::set_global_default(subscriber)?;
What Gets Auto-Captured
| Event Type |
Source |
Captured By |
| HTTP 5xx responses |
Axum error responses |
SentryHttpLayer |
panic!() / unwrap failures |
Rust panics |
sentry::init(panic) feature |
tracing::error!() |
App logging |
sentry_tracing bridge |
| Request context (URL, method, headers) |
HTTP layer |
SentryHttpLayer |
| User context (if set) |
App code |
sentry::configure_scope() |
Tasks
Important Notes
- Do NOT call
.enable_transaction() on SentryHttpLayer — TrapFall silently drops transaction envelopes in Phase 1. Adding transactions would waste bandwidth.
- Once Phase 1 (TrapFall transaction support) is implemented, flip the flag.
Effort: ~1.5 hours
Parent: #234 · Blocked by: #248, #249
Scope
Wire Sentry tower middleware into the Axum router for both Rungu and CIRA. Phase 1: errors only (no transactions — TrapFall doesn't support them yet).
Middleware Stack (bottom to top)
Implementation
Rungu (
rungud/src/server.rs)CIRA
Same pattern — insert in the main router builder.
Tracing Bridge (optional but recommended)
What Gets Auto-Captured
SentryHttpLayerpanic!()/ unwrap failuressentry::init(panic)featuretracing::error!()sentry_tracingbridgeSentryHttpLayersentry::configure_scope()Tasks
sentry_tower+sentry_tracingtower layers to Rungu routercfgflag)tagsfrom request: project, route, methodpanic!()→ verify capturedtracing::error!("test")→ verify capturedImportant Notes
.enable_transaction()onSentryHttpLayer— TrapFall silently drops transaction envelopes in Phase 1. Adding transactions would waste bandwidth.Effort: ~1.5 hours