@@ -927,30 +927,24 @@ def _assert_semantic_conventions_attributes(
927927 self ._assert_int_attribute (attributes_dict , SpanAttributes .HTTP_STATUS_CODE , status_code )
928928 # TODO: botocore instrumentation is not respecting PEER_SERVICE
929929 # self._assert_str_attribute(attributes_dict, SpanAttributes.PEER_SERVICE, "backend:8080")
930- self ._assert_specific_attributes (attributes_dict , request_specific_attributes )
931- self ._assert_specific_attributes (attributes_dict , response_specific_attributes )
932-
933- def _assert_specific_attributes (
934- self , attributes_dict : Dict [str , AnyValue ], specific_attributes : Dict [str , AnyValue ]
935- ) -> None :
936- for key , value in specific_attributes .items ():
937- is_valid_regex = False
938-
939- try :
940- is_valid_regex = self ._is_valid_regex (value )
941- except (StopIteration , RuntimeError , KeyError ):
942- is_valid_regex = False
943-
944- if is_valid_regex :
945- self ._assert_match_attribute (attributes_dict , key , value )
946- elif isinstance (value , str ):
947- self ._assert_str_attribute (attributes_dict , key , value )
948- elif isinstance (value , int ):
949- self ._assert_int_attribute (attributes_dict , key , value )
950- elif isinstance (value , float ):
951- self ._assert_float_attribute (attributes_dict , key , value )
930+ for key , value in request_specific_attributes .items ():
931+ self ._assert_attribute (attributes_dict , key , value )
932+
933+ for key , value in response_specific_attributes .items ():
934+ self ._assert_attribute (attributes_dict , key , value )
935+
936+ def _assert_attribute (self , attributes_dict : Dict [str , AnyValue ], key , value ) -> None :
937+ if isinstance (value , str ):
938+ if self ._is_valid_regex (value ):
939+ self ._assert_match_attribute (attributes_dict , key , value )
952940 else :
953- self ._assert_array_value_ddb_table_name (attributes_dict , key , value )
941+ self ._assert_str_attribute (attributes_dict , key , value )
942+ elif isinstance (value , int ):
943+ self ._assert_int_attribute (attributes_dict , key , value )
944+ elif isinstance (value , float ):
945+ self ._assert_float_attribute (attributes_dict , key , value )
946+ else :
947+ self ._assert_array_value_ddb_table_name (attributes_dict , key , value )
954948
955949 @override
956950 def _assert_metric_attributes (
0 commit comments