sortega commented on code in PR #68568:
URL: https://github.com/apache/airflow/pull/68568#discussion_r3435915327


##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -499,11 +500,29 @@ def check_version_id_exists_in_dr(self, dag_version_id: 
UUID, *, session: Sessio
         )
         return session.scalar(select_stmt)
 
+    def _dag_tags_for_stats(self) -> dict[str, str]:
+        """Convert dag tags to metric tags. Tags with ':' become key:value; 
others are standalone (empty value)."""
+        if not airflow_conf.getboolean("metrics", "dag_tags_in_metrics", 
fallback=False):
+            return {}
+        try:
+            # dag_model is a lazy, view-only relationship; on a 
detached/expired DagRun the
+            # load raises. Metric tagging must never break the caller, so 
swallow that.

Review Comment:
   Let's play safe. Now `get_running_dag_runs_to_examine` eager-loads 
`dag_model.tags (joinedload(...).selectinload(...))`, gated on the flag so 
there's zero cost when it's off.



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