Skip to content

Commit

Permalink
Global error handler cleanup - baggage propagator (#2251)
Browse files Browse the repository at this point in the history
Co-authored-by: Cijo Thomas <[email protected]>
  • Loading branch information
lalitb and cijothomas authored Oct 27, 2024
1 parent ed4d379 commit 9e9b838
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions opentelemetry-sdk/src/propagation/baggage.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use once_cell::sync::Lazy;
use opentelemetry::propagation::PropagationError;
use opentelemetry::{
baggage::{BaggageExt, KeyValueMetadata},
global,
otel_warn,
propagation::{text_map_propagator::FieldIter, Extractor, Injector, TextMapPropagator},
Context,
};
Expand Down Expand Up @@ -120,24 +119,26 @@ impl TextMapPropagator for BaggagePropagator {
decoded_props.as_str(),
))
} else {
global::handle_error(PropagationError::extract(
"invalid UTF8 string in key values",
"BaggagePropagator",
));
otel_warn!(
name: "BaggagePropagator.Extract.InvalidUTF8",
message = "Invalid UTF8 string in key values",
baggage_header = header_value,
);
None
}
} else {
global::handle_error(PropagationError::extract(
"invalid baggage key-value format",
"BaggagePropagator",
));
otel_warn!(
name: "BaggagePropagator.Extract.InvalidKeyValueFormat",
message = "Invalid baggage key-value format",
baggage_header = header_value,
);
None
}
} else {
global::handle_error(PropagationError::extract(
"invalid baggage format",
"BaggagePropagator",
));
otel_warn!(
name: "BaggagePropagator.Extract.InvalidFormat",
message = "Invalid baggage format",
baggage_header = header_value);
None
}
});
Expand Down

0 comments on commit 9e9b838

Please sign in to comment.