This is an automated email from the ASF dual-hosted git repository.
ephraimbuddy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 84454220b3c Stop dag processor from warning on every file path
normalized for stats (#71091)
84454220b3c is described below
commit 84454220b3c25bc4b2ef1be71e73d0cece380868
Author: bujjibabukatta <[email protected]>
AuthorDate: Tue Aug 18 06:48:46 2026 -0400
Stop dag processor from warning on every file path normalized for stats
(#71091)
* Stop dag processor from warning on every file path normalized for stats
* Apply suggestions from code review
Co-authored-by: Ephraim Anierobi <[email protected]>
---------
Co-authored-by: Ephraim Anierobi <[email protected]>
---
airflow-core/src/airflow/dag_processing/manager.py | 2 +-
airflow-core/tests/unit/dag_processing/test_manager.py | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/dag_processing/manager.py
b/airflow-core/src/airflow/dag_processing/manager.py
index 395ec25b371..d892f5d7f23 100644
--- a/airflow-core/src/airflow/dag_processing/manager.py
+++ b/airflow-core/src/airflow/dag_processing/manager.py
@@ -155,7 +155,7 @@ class DagFileInfo:
@property
def normalized_file_path_for_stats(self) -> str:
"""Return the relative file path normalized for use in stats tags."""
- return normalize_name_for_stats(str(self.rel_path))
+ return normalize_name_for_stats(str(self.rel_path), log_warning=False)
def _config_int_factory(section: str, key: str):
diff --git a/airflow-core/tests/unit/dag_processing/test_manager.py
b/airflow-core/tests/unit/dag_processing/test_manager.py
index 6d83d9c69ab..a6f82b13375 100644
--- a/airflow-core/tests/unit/dag_processing/test_manager.py
+++ b/airflow-core/tests/unit/dag_processing/test_manager.py
@@ -3802,3 +3802,20 @@ class TestMultiTeamMetrics:
# Two bundles resolved in a single batched query; the repeat call is
served from cache.
mock_get_team_names.assert_called_once()
assert manager._bundle_name_to_team_name == {"bundle_a": "team_alpha",
"bundle_b": "team_alpha"}
+
+
+def test_normalized_file_path_for_stats_does_not_warn(caplog):
+ """
+ rel_path always contains "/" for any nested DAG file, so normalizing it
for stats
+ always requires substitution -- this must not log a warning on every DAG
file, every
+ processing cycle.
+ """
+ dag_file_info = DagFileInfo(
+ bundle_name="testing", bundle_path=TEST_DAGS_FOLDER,
rel_path=Path("dags/test/test_dag.py")
+ )
+
+ with caplog.at_level(logging.WARNING,
logger="airflow._shared.observability.metrics.stats"):
+ result = dag_file_info.normalized_file_path_for_stats
+
+ assert result == "dags_test_test_dag.py"
+ assert caplog.entries == []