@cryptotaxi247 / netdata-1 / commits / 191de6f12

Always capture backtrace on panic. (#21681)

* Install panic hook that uses tracing * [NFC] Formatting.

vkalintiris committed Jan 31, 2026 at 20:38 UTC 191de6f12fccd7b360c42acdf4a2531876569680
2 files changed +15 -9
src/crates/netdata-otel/otel-plugin/src/lib.rs
+8 -9
@@ -67,17 +67,16 @@ async fn run_internal() -> Result<()> {
67 let config = PluginConfig::new().context("Failed to initialize plugin configuration")?;
68
69 // 5. Create gRPC services
70 - let metrics_service = NetdataMetricsService::new(config.clone())
71 - .context("Failed to create metrics service")?;
72 - let logs_service = NetdataLogsService::new(config.clone())
73 - .context("Failed to create logs service")?;
70 + let metrics_service =
71 + NetdataMetricsService::new(config.clone()).context("Failed to create metrics service")?;
72 + let logs_service =
73 + NetdataLogsService::new(config.clone()).context("Failed to create logs service")?;
74
75 // 7. Parse gRPC endpoint address
76 - let addr = config
77 - .endpoint
78 - .path
79 - .parse()
80 - .with_context(|| format!("Failed to parse endpoint address: {}", config.endpoint.path))?;
76 + let addr =
77 + config.endpoint.path.parse().with_context(|| {
78 + format!("Failed to parse endpoint address: {}", config.endpoint.path)
79 + })?;
80
81 // 8. Build gRPC server (with TLS if configured)
82 let mut server_builder = Server::builder();
src/crates/netdata-plugin/rt/src/tracing_setup.rs
+7
@@ -99,4 +99,11 @@ pub fn init_tracing() {
99 log_method_description(&log_method),
100 filter_str,
101 );
102 +
103 + // Install panic hook that always captures backtraces.
104 + // We want backtraces on panic regardless of RUST_BACKTRACE setting.
105 + std::panic::set_hook(Box::new(|panic_info| {
106 + let backtrace = std::backtrace::Backtrace::force_capture();
107 + tracing::error!("{panic_info}\n{backtrace}");
108 + }));
109 }