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


##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -1374,6 +1374,12 @@ def process_executor_events(
             
.options(joinedload(TI.dag_run).selectinload(DagRun.created_dag_version))
             .options(joinedload(TI.dag_version))
         )
+        # When emitting Dag tags as metric tags, eager-load dag_model.tags so 
the per-finished-task
+        # ti_failures / operator_failures / task.*_duration metrics carry them 
without a per-TI lazy load.
+        if conf.getboolean("metrics", "dag_tags_in_metrics", fallback=False):

Review Comment:
   Missed this first time around, but `conf.getboolean` is surprisingly 
expensive (perhaps we should have added caching at the config layer, but not 
part of this PR), and since this is called for every task instance that reaches 
terminal state, please could we create a `self._dag_tags_in_metrics` which we 
load in `__init__` to avoid calling conf.getboolean in scheduler hot path.



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