@@ -60,9 +60,9 @@ def write_cache_to_s3(self, data):
6060 DD_S3_BUCKET_NAME , self .get_cache_name_with_prefix ()
6161 )
6262 s3_object .put (Body = (bytes (json .dumps (data ).encode ("UTF-8" ))))
63- except ClientError :
63+ except ClientError as e :
6464 send_forwarder_internal_metrics ("s3_cache_write_failure" )
65- self .logger .debug ("Unable to write new cache to S3" , exc_info = True )
65+ self .logger .debug (f "Unable to write new cache to S3: { e } " , exc_info = True )
6666
6767 def acquire_s3_cache_lock (self ):
6868 """Acquire cache lock"""
@@ -76,16 +76,16 @@ def acquire_s3_cache_lock(self):
7676 last_modified_unix_time = get_last_modified_time (file_content )
7777 if last_modified_unix_time + DD_S3_CACHE_LOCK_TTL_SECONDS >= time ():
7878 return False
79- except Exception :
80- self .logger .debug ("Unable to get cache lock file" )
79+ except Exception as e :
80+ self .logger .debug (f "Unable to get cache lock file: { e } " )
8181
8282 # lock file doesn't exist, create file to acquire lock
8383 try :
8484 cache_lock_object .put (Body = (bytes ("lock" .encode ("UTF-8" ))))
8585 send_forwarder_internal_metrics ("s3_cache_lock_acquired" )
8686 self .logger .debug ("S3 cache lock acquired" )
87- except ClientError :
88- self .logger .debug ("Unable to write S3 cache lock file" , exc_info = True )
87+ except ClientError as e :
88+ self .logger .debug (f "Unable to write S3 cache lock file: { e } " , exc_info = True )
8989 return False
9090
9191 return True
@@ -99,9 +99,9 @@ def release_s3_cache_lock(self):
9999 cache_lock_object .delete ()
100100 send_forwarder_internal_metrics ("s3_cache_lock_released" )
101101 self .logger .debug ("S3 cache lock released" )
102- except ClientError :
102+ except ClientError as e :
103103 send_forwarder_internal_metrics ("s3_cache_lock_release_failure" )
104- self .logger .debug ("Unable to release S3 cache lock" , exc_info = True )
104+ self .logger .debug (f "Unable to release S3 cache lock: { e } " , exc_info = True )
105105
106106 def get_cache_from_s3 (self ):
107107 """Retrieves tags cache from s3 and returns the body along with
@@ -113,9 +113,9 @@ def get_cache_from_s3(self):
113113 file_content = cache_object .get ()
114114 tags_cache = json .loads (file_content ["Body" ].read ().decode ("utf-8" ))
115115 last_modified_unix_time = get_last_modified_time (file_content )
116- except :
116+ except Exception as e :
117117 send_forwarder_internal_metrics ("s3_cache_fetch_failure" )
118- self .logger .debug ("Unable to fetch cache from S3" , exc_info = True )
118+ self .logger .debug (f "Unable to fetch cache from S3: { e } " , exc_info = True )
119119 return {}, - 1
120120
121121 return tags_cache , last_modified_unix_time
0 commit comments