@@ -260,11 +260,11 @@ impl RedisPlugin {
260260 Ok ( ctx. create_exit_span ( & format ! ( "{}->{}" , class_name, function_name) , & addr) )
261261 } ) ?;
262262
263- span. with_span_object_mut ( |span| {
264- span . set_span_layer ( SpanLayer :: Cache ) ;
265- span . component_id = COMPONENT_PHP_REDIS_ID ;
266- span . add_tag ( TAG_CACHE_TYPE , "redis" ) ;
267- } ) ;
263+ let mut span_object = span. span_object_mut ( ) ;
264+ span_object . set_span_layer ( SpanLayer :: Cache ) ;
265+ span_object . component_id = COMPONENT_PHP_REDIS_ID ;
266+ span_object . add_tag ( TAG_CACHE_TYPE , "redis" ) ;
267+ drop ( span_object ) ;
268268
269269 Ok ( Box :: new ( span) )
270270 } ) ,
@@ -306,21 +306,21 @@ impl RedisPlugin {
306306 Ok ( ctx. create_exit_span ( & format ! ( "{}->{}" , class_name, function_name) , & peer) )
307307 } ) ?;
308308
309- span. with_span_object_mut ( |span| {
310- span . set_span_layer ( SpanLayer :: Cache ) ;
311- span . component_id = COMPONENT_PHP_REDIS_ID ;
312- span . add_tag ( TAG_CACHE_TYPE , "redis" ) ;
313- span . add_tag (
314- TAG_CACHE_CMD ,
315- * REDIS_ALL_MAPPING . get ( function_name_key) . unwrap ( ) ,
316- ) ;
317- if let Some ( op) = op {
318- span . add_tag ( TAG_CACHE_OP , op) ;
319- }
320- if let Some ( key) = key {
321- span . add_tag ( TAG_CACHE_KEY , key)
322- }
323- } ) ;
309+ let mut span_object = span. span_object_mut ( ) ;
310+ span_object . set_span_layer ( SpanLayer :: Cache ) ;
311+ span_object . component_id = COMPONENT_PHP_REDIS_ID ;
312+ span_object . add_tag ( TAG_CACHE_TYPE , "redis" ) ;
313+ span_object . add_tag (
314+ TAG_CACHE_CMD ,
315+ * REDIS_ALL_MAPPING . get ( function_name_key) . unwrap ( ) ,
316+ ) ;
317+ if let Some ( op) = op {
318+ span_object . add_tag ( TAG_CACHE_OP , op) ;
319+ }
320+ if let Some ( key) = key {
321+ span_object . add_tag ( TAG_CACHE_KEY , key)
322+ }
323+ drop ( span_object ) ;
324324
325325 Ok ( Box :: new ( span) )
326326 } ) ,
@@ -362,22 +362,21 @@ fn after_hook(
362362
363363 let ex = unsafe { ZObj :: try_from_mut_ptr ( eg ! ( exception) ) } ;
364364 if let Some ( ex) = ex {
365- span. with_span_object_mut ( |span| {
366- span . is_error = true ;
365+ let mut span_object = span. span_object_mut ( ) ;
366+ span_object . is_error = true ;
367367
368- let mut logs = Vec :: new ( ) ;
369- if let Ok ( class_name) = ex. get_class ( ) . get_name ( ) . to_str ( ) {
370- logs. push ( ( "Exception Class" , class_name. to_owned ( ) ) ) ;
371- }
372- if let Some ( message) = ex. get_property ( "message" ) . as_z_str ( ) {
373- if let Ok ( message) = message. to_str ( ) {
374- logs. push ( ( "Exception Message" , message. to_owned ( ) ) ) ;
375- }
376- }
377- if !logs. is_empty ( ) {
378- span. add_log ( logs) ;
368+ let mut logs = Vec :: new ( ) ;
369+ if let Ok ( class_name) = ex. get_class ( ) . get_name ( ) . to_str ( ) {
370+ logs. push ( ( "Exception Class" , class_name. to_owned ( ) ) ) ;
371+ }
372+ if let Some ( message) = ex. get_property ( "message" ) . as_z_str ( ) {
373+ if let Ok ( message) = message. to_str ( ) {
374+ logs. push ( ( "Exception Message" , message. to_owned ( ) ) ) ;
379375 }
380- } ) ;
376+ }
377+ if !logs. is_empty ( ) {
378+ span_object. add_log ( logs) ;
379+ }
381380 }
382381
383382 Ok ( ( ) )
0 commit comments