Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow-core/src/airflow/dag_processing/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def presence_key(self) -> tuple[str, Path]:
@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):
Expand Down
17 changes: 17 additions & 0 deletions airflow-core/tests/unit/dag_processing/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3620,3 +3620,20 @@ def test_get_team_names_batches_and_caches(self, mock_get_team_names):
# 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 == []