@@ -458,18 +458,15 @@ def set_multi_modality_map(self, key: str):
458458 def set_baggage (self , baggage_item : Dict [str , str ]):
459459 if not baggage_item :
460460 return
461- self .set_baggage_escape (baggage_item , True )
461+ self .set_baggage_escape (baggage_item )
462462
463- def set_baggage_escape (self , baggage_item : Dict [str , str ], escape : bool ):
463+ def set_baggage_escape (self , baggage_item : Dict [str , str ]):
464464 if not baggage_item :
465465 return
466466 try :
467467 for key , value in baggage_item .items ():
468468 if self .is_valid_baggage_item (key , value ):
469469 self .set_tags ({key : value })
470- if escape :
471- key = urllib .parse .quote (key )
472- value = urllib .parse .quote (value )
473470 self .set_baggage_item (key , value )
474471 else :
475472 logger .error (f"[trace] invalid baggageItem:{ key } :{ value } " )
@@ -565,7 +562,7 @@ def to_header(self) -> Dict[str, str]:
565562 def to_header_baggage (self ) -> str :
566563 if not self .baggage :
567564 return ""
568- return "," .join (f"{ k } ={ v } " for k , v in self .baggage ().items () if k and v )
565+ return "," .join (f"{ urllib . parse . quote ( k ) } ={ urllib . parse . quote ( v ) } " for k , v in self .baggage ().items () if k and v )
569566
570567 def to_header_parent (self ) -> str :
571568 return f"{ GLOBAL_TRACE_VERSION :02x} -{ self .trace_id } -{ self .span_id } -{ self .flags :02x} "
0 commit comments