Skip to content

Commit 9e9b838

Browse files
lalitbcijothomas
andauthored
Global error handler cleanup - baggage propagator (#2251)
Co-authored-by: Cijo Thomas <[email protected]>
1 parent ed4d379 commit 9e9b838

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

opentelemetry-sdk/src/propagation/baggage.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use once_cell::sync::Lazy;
2-
use opentelemetry::propagation::PropagationError;
32
use opentelemetry::{
43
baggage::{BaggageExt, KeyValueMetadata},
5-
global,
4+
otel_warn,
65
propagation::{text_map_propagator::FieldIter, Extractor, Injector, TextMapPropagator},
76
Context,
87
};
@@ -120,24 +119,26 @@ impl TextMapPropagator for BaggagePropagator {
120119
decoded_props.as_str(),
121120
))
122121
} else {
123-
global::handle_error(PropagationError::extract(
124-
"invalid UTF8 string in key values",
125-
"BaggagePropagator",
126-
));
122+
otel_warn!(
123+
name: "BaggagePropagator.Extract.InvalidUTF8",
124+
message = "Invalid UTF8 string in key values",
125+
baggage_header = header_value,
126+
);
127127
None
128128
}
129129
} else {
130-
global::handle_error(PropagationError::extract(
131-
"invalid baggage key-value format",
132-
"BaggagePropagator",
133-
));
130+
otel_warn!(
131+
name: "BaggagePropagator.Extract.InvalidKeyValueFormat",
132+
message = "Invalid baggage key-value format",
133+
baggage_header = header_value,
134+
);
134135
None
135136
}
136137
} else {
137-
global::handle_error(PropagationError::extract(
138-
"invalid baggage format",
139-
"BaggagePropagator",
140-
));
138+
otel_warn!(
139+
name: "BaggagePropagator.Extract.InvalidFormat",
140+
message = "Invalid baggage format",
141+
baggage_header = header_value);
141142
None
142143
}
143144
});

0 commit comments

Comments
 (0)