jedcunningham commented on code in PR #61079:
URL: https://github.com/apache/airflow/pull/61079#discussion_r2742832447
##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -1195,10 +1195,18 @@ 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:
+ # Normalize names to ensure they only contain valid characters for
stats (alphanumeric, underscore, dot, dash)
+ file_name = normalize_name_for_stats(Path(relative_fileloc).stem)
+ # bundle_name is included to distinguish files with the same name
across different bundles
+ normalized_bundle = normalize_name_for_stats(bundle_name)
+
Stats.timing(f"dag_processing.last_duration.{normalized_bundle}.{file_name}",
stat.last_duration)
+ Stats.timing(
+ "dag_processing.last_duration",
+ stat.last_duration,
+ tags={"file_name": file_name, "bundle_name": normalized_bundle},
Review Comment:
I genuinely don't know the right call here, but seems like if otel is happy
with the non-sanitized filename, that'd be better to pass.
--
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]