jedcunningham commented on code in PR #61079:
URL: https://github.com/apache/airflow/pull/61079#discussion_r2733129320


##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -1195,10 +1195,11 @@ def process_parse_results(
             run_count=run_count + 1,
         )
 
-    # TODO: AIP-66 emit metrics
-    # file_name = Path(dag_file.path).stem
-    # Stats.timing(f"dag_processing.last_duration.{file_name}", 
stat.last_duration)
-    # Stats.timing("dag_processing.last_duration", stat.last_duration, 
tags={"file_name": file_name})
+    # Note: relative_fileloc has a None default. In practice it is always 
provided but code defensively here in case
+    if relative_fileloc is not None and stat.last_duration is not None:
+        file_name = Path(relative_fileloc).stem
+        Stats.timing(f"dag_processing.last_duration.{file_name}", 
stat.last_duration)

Review Comment:
   We should likely include the bundle name as well.



##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -1195,10 +1195,11 @@ def process_parse_results(
             run_count=run_count + 1,
         )
 
-    # TODO: AIP-66 emit metrics
-    # file_name = Path(dag_file.path).stem
-    # Stats.timing(f"dag_processing.last_duration.{file_name}", 
stat.last_duration)
-    # Stats.timing("dag_processing.last_duration", stat.last_duration, 
tags={"file_name": file_name})
+    # Note: relative_fileloc has a None default. In practice it is always 
provided but code defensively here in case
+    if relative_fileloc is not None and stat.last_duration is not None:
+        file_name = Path(relative_fileloc).stem

Review Comment:
   I know it was like this before, but only having the filename feels not 
unique enough to me...



##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -1195,10 +1195,11 @@ def process_parse_results(
             run_count=run_count + 1,
         )
 
-    # TODO: AIP-66 emit metrics
-    # file_name = Path(dag_file.path).stem
-    # Stats.timing(f"dag_processing.last_duration.{file_name}", 
stat.last_duration)
-    # Stats.timing("dag_processing.last_duration", stat.last_duration, 
tags={"file_name": file_name})
+    # Note: relative_fileloc has a None default. In practice it is always 
provided but code defensively here in case
+    if relative_fileloc is not None and stat.last_duration is not None:
+        file_name = Path(relative_fileloc).stem
+        Stats.timing(f"dag_processing.last_duration.{file_name}", 
stat.last_duration)

Review Comment:
   I also wonder if we need to sanitize the filename potentially, similar to 
`normalize_pool_name_for_stats`?



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