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 2021/03/03 18:57:42 UTC

[GitHub] [airflow] arbass22 commented on a change in pull request #12158: StatsD metrics have tags + generate reference docs

arbass22 commented on a change in pull request #12158:
URL: https://github.com/apache/airflow/pull/12158#discussion_r586697071



##########
File path: airflow/models/taskinstance.py
##########
@@ -1255,11 +1258,13 @@ def signal_handler(signum, frame):  # pylint: disable=unused-argument
 
         end_time = time.time()
         duration = timedelta(seconds=end_time - start_time)
+        dag_id = task_copy.dag_id
+        task_id = task_copy.task_id
         Stats.timing(
-            f'dag.{task_copy.dag_id}.{task_copy.task_id}.duration',
-            duration,
+            'dag.{dag_id}.{task_id}.duration', duration, labels={"dag_id": dag_id, "task_id": task_id}
         )
-        Stats.incr(f'operator_successes_{self.task.task_type}', 1, 1)
+        task_type = self.task.task_type
+        Stats.incr('operator_successes_{task_type}', 1, 1, labels={"task_type": task_type})
         Stats.incr('ti_successes')

Review comment:
       Would it be possible to add the dag/task tags to ti_successes and ti_failures as well? I think this would useful for aggregation so we can ignore or watch specific dags for failures




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