File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
src/instana/instrumentation/aws Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -59,17 +59,24 @@ def collect_s3_injected_attributes(
5959 span .set_attribute ("s3.op" , operations [wrapped .__name__ ])
6060 if "Bucket" in kwargs :
6161 span .set_attribute ("s3.bucket" , kwargs ["Bucket" ])
62- elif wrapped .__name__ in ["download_file" , "download_fileobj" ]:
63- span .set_attribute ("s3.bucket" , args [0 ])
64- else :
65- span .set_attribute ("s3.bucket" , args [1 ])
62+ elif len (args ) > 1 :
63+ if wrapped .__name__ in ["download_file" , "download_fileobj" ]:
64+ span .set_attribute ("s3.bucket" , args [0 ])
65+ else :
66+ span .set_attribute ("s3.bucket" , args [1 ])
67+ except Exception :
68+ logger .debug (
69+ f"collect_s3_injected_attributes collect error: { wrapped .__name__ } " , exc_info = True
70+ )
71+
72+ try :
73+ return wrapped (* args , ** kwargs )
6674 except Exception as exc :
6775 span .record_exception (exc )
6876 logger .debug (
69- "collect_s3_injected_attributes: collect error" , exc_info = True
77+ f "collect_s3_injected_attributes error: { wrapped . __name__ } " , exc_info = True
7078 )
71-
72- return wrapped (* args , ** kwargs )
79+ raise
7380
7481 for method in [
7582 "upload_file" ,
You can’t perform that action at this time.
0 commit comments