ferruzzi commented on code in PR #30612:
URL: https://github.com/apache/airflow/pull/30612#discussion_r1164728261


##########
airflow/models/taskinstance.py:
##########
@@ -1330,6 +1330,18 @@ def check_and_change_state_before_execution(
 
         if not test_mode:
             session.add(Log(State.RUNNING, self))
+
+        if not self.end_date:
+            # if the task has an end date, it means that this is not its first 
round.
+            # we send the adoption time metric only on the first try, 
otherwise it gets more complex.
+            adoption_time = (timezone.utcnow() - 
self.start_date).total_seconds()
+            
Stats.timing(f"dag.{self.task.dag_id}.{self.task.task_id}.adoption_time", 
adoption_time)

Review Comment:
   Any reason not to include tags on this one?



-- 
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