Skip to content

Commit 8c30c47

Browse files
committed
add otel_error
1 parent 5575c4f commit 8c30c47

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

opentelemetry/src/trace/context.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Context extensions for tracing
22
use crate::{
3-
global,
3+
global, otel_debug,
44
trace::{Span, SpanContext, Status},
55
Context, ContextGuard, KeyValue,
66
};
@@ -55,8 +55,12 @@ impl SpanRef<'_> {
5555
if let Some(ref inner) = self.0.inner {
5656
match inner.lock() {
5757
Ok(mut locked) => f(&mut locked),
58-
Err(_) => {
59-
// Ignoring the error silently. TODO: Add specific handling if needed.
58+
Err(err) => {
59+
otel_debug!(
60+
name: "SpanRef.LockFailed",
61+
message = "Failed to acquire lock for SpanRef: {:?}",
62+
reason = format!("{:?}", err),
63+
span_context = format!("{:?}", self.0.span_context));
6064
}
6165
}
6266
}

0 commit comments

Comments
 (0)