From c3e5ac1b749048ec750b38706bf69795cf777879 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 30 Jul 2024 11:26:02 +0200 Subject: [PATCH] "fix" panic --- tracing-trace/src/processor/span_stats.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tracing-trace/src/processor/span_stats.rs b/tracing-trace/src/processor/span_stats.rs index 584fe53f8..9fb279325 100644 --- a/tracing-trace/src/processor/span_stats.rs +++ b/tracing-trace/src/processor/span_stats.rs @@ -113,11 +113,17 @@ pub fn to_call_stats( let span = *span; if let Some(parent_id) = span.parent_id { - let (_, _, parent_self_time) = spans.get_mut(&parent_id).unwrap(); + let Some((_, _, parent_self_time)) = spans.get_mut(&parent_id) else { + tracing::warn!("could not find referenced parent span"); + continue; + }; parent_self_time.add_child_range(self_range.clone()) } total_self_time.add_child_range(self_range); - let (_, call_list) = calls.get_mut(&span.call_id).unwrap(); + let Some((_, call_list)) = calls.get_mut(&span.call_id) else { + tracing::warn!("could not find referenced call"); + continue; + }; call_list.push((end - begin, self_duration)); } Entry::SpanClose(SpanClose { id, time: _ }) => {