uranusjr commented on code in PR #23597:
URL: https://github.com/apache/airflow/pull/23597#discussion_r869567973


##########
airflow/models/connection.py:
##########
@@ -208,8 +208,8 @@ def get_uri(self) -> str:
         """Return connection in URI format"""
         if '_' in self.conn_type:
             self.log.warning(
-                f"Connection schemes (type: {str(self.conn_type)}) "
-                f"shall not contain '_' according to RFC3986."
+                "Connection schemes (type: %s) shall not contain '_' according 
to RFC3986.",
+                str(self.conn_type),

Review Comment:
   ```suggestion
                   self.conn_type,
   ```
   
   The logging framework stringify things automatically.



##########
airflow/providers/google/cloud/sensors/dataproc.py:
##########
@@ -79,8 +79,9 @@ def poke(self, context: "Context") -> bool:
                     job_id=self.dataproc_job_id, region=self.region, 
project_id=self.project_id
                 )
             except ServerError as err:
-                self.log.info(f"DURATION RUN: {self._duration()}")
-                if self._duration() > self.wait_timeout:
+                duration = self._duration()
+                self.log.info("DURATION RUN: %f")

Review Comment:
   ```suggestion
                   self.log.info("DURATION RUN: %f", duration)
   ```



##########
airflow/models/dagrun.py:
##########
@@ -790,7 +790,7 @@ def 
_emit_true_scheduling_delay_stats_for_finished_state(self, finished_tis: Lis
                 if true_delay.total_seconds() > 0:
                     
Stats.timing(f'dagrun.{dag.dag_id}.first_task_scheduling_delay', true_delay)
         except Exception as e:
-            self.log.warning(f'Failed to record first_task_scheduling_delay 
metric:\n{e}')
+            self.log.warning('Failed to record first_task_scheduling_delay 
metric:\n%s', e)

Review Comment:
   How about
   
   ```suggestion
               self.log.warning(
                   'Failed to record first_task_scheduling_delay metric.',
                   exc_info=True,
               )
   ```
   
   (Also need to remove `as e` above)



##########
airflow/providers/google/suite/transfers/sql_to_sheets.py:
##########
@@ -120,7 +120,7 @@ def execute(self, context: Any) -> None:
             impersonation_chain=self.impersonation_chain,
         )
 
-        self.log.info(f"Uploading data to 
https://docs.google.com/spreadsheets/d/{self.spreadsheet_id}";)
+        self.log.info("Uploading data to 
https://docs.google.com/spreadsheets/d/%s";, self.spreadsheet_id)

Review Comment:
   This particular one is tricky; having a URL like this doesn’t really make 
sense without formatting. Maybe we should do
   
   ```suggestion
           if self.log.isEnabledFor("info"):
               url = 
f"https://docs.google.com/spreadsheets/d/{self.spreadsheet_id}";
               self.log.info("Uploading data to %s", url)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to