You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/05/05 02:06:07 UTC

[GitHub] [airflow] jhtimmins commented on a change in pull request #8680: Add metric for start/end task run

jhtimmins commented on a change in pull request #8680:
URL: https://github.com/apache/airflow/pull/8680#discussion_r419825461



##########
File path: airflow/models/taskinstance.py
##########
@@ -1080,6 +1081,8 @@ def signal_handler(signum, frame):
             self.handle_failure(e, test_mode, context)
             raise
 
+        Stats.incr('ti.complete.{}.{}.{}'.format(task.dag_id, task.task_id, self.state), 1, 1)

Review comment:
       Just wondering, does it make more sense to put it here rather than after the success callbacks on lines 1087-1093, inside a `finally` block? 

##########
File path: airflow/models/taskinstance.py
##########
@@ -1080,6 +1081,8 @@ def signal_handler(signum, frame):
             self.handle_failure(e, test_mode, context)
             raise
 
+        Stats.incr('ti.complete.{}.{}.{}'.format(task.dag_id, task.task_id, self.state), 1, 1)

Review comment:
       To make these names as meaningful as possible, `starts` and `finishes` (or similar) might be more clear, so it's clear that it's referring to a counter and not a timestamp.
   
   https://airflow.apache.org/docs/stable/metrics.html#counters
   * `ti_starts_<dag_id>_<task_id>`
   * `ti_finishes_<dag_id>_<task_id>_<state>`
   




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org