vandonr-amz commented on code in PR #30612:
URL: https://github.com/apache/airflow/pull/30612#discussion_r1165849905


##########
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:
   I followed what is done everywhere else in the code, one metric is emitted 
with the "variables" in the name (the "legacy" metric), and a similar one with 
a constant name and the variables in tags.



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