Skip to content

Commit 9382bfb

Browse files
authored
Global error handler cleanup - trace API (#2252)
1 parent 4c7bf58 commit 9382bfb

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

opentelemetry/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ futures-sink = "0.3"
2626
once_cell = { workspace = true }
2727
pin-project-lite = { workspace = true, optional = true }
2828
thiserror = { workspace = true }
29+
tracing = {workspace = true, optional = true} # optional for opentelemetry internal logging
2930

3031
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies]
3132
js-sys = "0.3.63"
@@ -38,6 +39,7 @@ testing = ["trace", "metrics"]
3839
logs = []
3940
logs_level_enabled = ["logs"]
4041
otel_unstable = []
42+
internal-logs = ["tracing"]
4143

4244
[dev-dependencies]
4345
opentelemetry_sdk = { path = "../opentelemetry-sdk", features = ["logs_level_enabled"]} # for documentation tests

opentelemetry/src/trace/context.rs

Lines changed: 8 additions & 2 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,7 +55,13 @@ impl SpanRef<'_> {
5555
if let Some(ref inner) = self.0.inner {
5656
match inner.lock() {
5757
Ok(mut locked) => f(&mut locked),
58-
Err(err) => global::handle_error(err),
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));
64+
}
5965
}
6066
}
6167
}

0 commit comments

Comments
 (0)