@@ -7,6 +7,7 @@ use libdd_trace_utils::span::v04::{
77 AttributeAnyValueBytes , AttributeArrayValueBytes , SpanBytes , SpanEventBytes , SpanLinkBytes ,
88 VecMap ,
99} ;
10+ use libdd_trace_utils:: span:: vec_map:: Tombstone ;
1011use std:: borrow:: Cow ;
1112use std:: collections:: HashMap ;
1213use std:: ffi:: { c_char, CString } ;
@@ -61,11 +62,17 @@ fn insert_vec_map<V>(map: &mut VecMap<BytesString, V>, key: CharSlice, value: V)
6162}
6263
6364#[ inline]
64- fn remove_vec_map < V > ( map : & mut VecMap < BytesString , V > , key : CharSlice ) {
65+ fn remove_vec_map_slow < V > ( map : & mut VecMap < BytesString , V > , key : CharSlice ) {
6566 let bytes_str_key = convert_char_slice_to_bytes_string ( key) ;
6667 map. remove_slow ( & bytes_str_key) ;
6768}
6869
70+ #[ inline]
71+ fn remove_vec_map < V : Tombstone > ( map : & mut VecMap < BytesString , V > , key : CharSlice ) {
72+ let bytes_str_key = convert_char_slice_to_bytes_string ( key) ;
73+ map. remove_unset ( & bytes_str_key) ;
74+ }
75+
6976#[ inline]
7077fn exists_vec_map < V > ( map : & VecMap < BytesString , V > , key : CharSlice ) -> bool {
7178 let bytes_str_key = convert_char_slice_to_bytes_string ( key) ;
@@ -385,7 +392,7 @@ pub extern "C" fn ddog_add_span_metrics(span: &mut SpanBytes, key: CharSlice, va
385392
386393#[ no_mangle]
387394pub extern "C" fn ddog_del_span_metrics ( span : & mut SpanBytes , key : CharSlice ) {
388- remove_vec_map ( & mut span. metrics , key) ;
395+ remove_vec_map_slow ( & mut span. metrics , key) ;
389396}
390397
391398#[ no_mangle]
@@ -428,7 +435,7 @@ pub extern "C" fn ddog_add_span_meta_struct(span: &mut SpanBytes, key: CharSlice
428435
429436#[ no_mangle]
430437pub extern "C" fn ddog_del_span_meta_struct ( span : & mut SpanBytes , key : CharSlice ) {
431- remove_vec_map ( & mut span. meta_struct , key) ;
438+ remove_vec_map_slow ( & mut span. meta_struct , key) ;
432439}
433440
434441#[ no_mangle]
0 commit comments