sfackler / rust-log-panics

Apache License 2.0
52 stars 14 forks source link

Skip #15

Open eko-wibowo opened 9 months ago

eko-wibowo commented 9 months ago

Hi

I am working on project that have HTTP API that is using actix web (with tokio async). I enabled debug=line-tables-only to get line numbers on stacktrace. The goal is to be able to debug panic easily when it happened on prod (log is sent to datadog)

Changes

[profile.release]
lto = true
debug = "line-tables-only"

Before

   0: backtrace::capture::Backtrace::new
   1: log_panics::Config::install_panic_hook::{{closure}}
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::begin_panic::{{closure}}
   4: std::sys_common::backtrace::__rust_end_short_backtrace
   5: std::panicking::begin_panic
   6: <<Redacted>>
   7: <<Redacted>>
   8: <<Redacted>>
   9: actix_web::handler::handler_service::{{closure}}::{{closure}}
  10: <actix_web::resource::Resource<T> as actix_web::service::HttpServiceFactory>::register::{{closure}}::{{closure}}
  11: <actix_cors::middleware::CorsMiddleware<S> as actix_service::Service<actix_web::service::ServiceRequest>>::call::{{closure}}
  12: <actix_service::map_err::MapErrFuture<A,Req,F,E> as core::future::future::Future>::poll
  13: actix_http::h1::dispatcher::InnerDispatcher<T,S,B,X,U>::poll_response
  14: <actix_http::h1::dispatcher::Dispatcher<T,S,B,X,U> as core::future::future::Future>::poll
  15: tokio::runtime::task::raw::poll
  16: tokio::task::local::LocalSet::tick
  17: <tokio::task::local::RunUntil<T> as core::future::future::Future>::poll
  18: std::sys_common::backtrace::__rust_begin_short_backtrace
  19: core::ops::function::FnOnce::call_once{{vtable.shim}}
  20: std::sys::unix::thread::Thread::new::thread_start
  21: __pthread_joiner_wake

However this changes caused the stacktraces to blow up to 260kb, due to a lot of async tokio on actix web layer that happened above (i.e callers of) main.rs. Are there a way to filter out such stacktraces from that layer? i.e before main.rs, ignore.

sfackler commented 9 months ago

There is not currently a way to filter them.