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 2019/08/23 08:45:39 UTC

[GitHub] [airflow] marengaz commented on a change in pull request #5890: [AIRFLOW-5274] dag loading duration metric name too long

marengaz commented on a change in pull request #5890: [AIRFLOW-5274] dag loading duration metric name too long
URL: https://github.com/apache/airflow/pull/5890#discussion_r317032211
 
 

 ##########
 File path: airflow/models/dagbag.py
 ##########
 @@ -409,11 +409,15 @@ def collect_dags(
             stats, key=lambda x: x.duration, reverse=True)
         for file_stat in self.dagbag_stats:
             dag_ids = dags_by_name[file_stat.dags]
-            if file_stat.dag_num >= 1:
-                # if we found multiple dags per file, the stat is 'dag_id1 _ dag_id2'
-                dag_names = '_'.join(dag_ids)
+            if file_stat.dag_num == 1:
+                # if the file has only one dag, it uses dag.loading-duration.dagID for metric
                 Stats.timing('dag.loading-duration.{}'.
-                             format(dag_names),
+                             format(dag_ids[0]),
+                             file_stat.duration)
+            elif file_stat.dag_num > 1:
+                # if the file has multiple dags, use dag.loading-duration.file for metric
+                Stats.timing('dag.loading-duration.{}'.
+                             format(file_stat.file),
 
 Review comment:
   do we need to replace slashes, or some other special chars?

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


With regards,
Apache Git Services