From 9e9b8384ae067596211cbc8e87228c6080fc2171 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Sat, 26 Oct 2024 17:08:31 -0700 Subject: [PATCH] Global error handler cleanup - baggage propagator (#2251) Co-authored-by: Cijo Thomas --- opentelemetry-sdk/src/propagation/baggage.rs | 29 ++++++++++---------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/opentelemetry-sdk/src/propagation/baggage.rs b/opentelemetry-sdk/src/propagation/baggage.rs index 397edc3fc9..35567b4b4b 100644 --- a/opentelemetry-sdk/src/propagation/baggage.rs +++ b/opentelemetry-sdk/src/propagation/baggage.rs @@ -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, }; @@ -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 } });