aksdevs commented on code in PR #62152:
URL: https://github.com/apache/airflow/pull/62152#discussion_r2831207325


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dashboard.py:
##########
@@ -58,48 +58,44 @@ def historical_metrics(
     """Return cluster activity historical metrics."""
     current_time = timezone.utcnow()
     permitted_dag_ids = cast("set[str]", readable_dags_filter.value)
-    # DagRuns
-    dag_run_types = session.execute(
-        select(DagRun.run_type, func.count(DagRun.run_id))
-        .where(
-            func.coalesce(DagRun.start_date, current_time) >= start_date,
-            func.coalesce(DagRun.end_date, current_time) <= 
func.coalesce(end_date, current_time),
-        )
-        .where(DagRun.dag_id.in_(permitted_dag_ids))
-        .group_by(DagRun.run_type)
-    ).all()
 
-    dag_run_states = session.execute(
-        select(DagRun.state, func.count(DagRun.run_id))
-        .where(
-            func.coalesce(DagRun.start_date, current_time) >= start_date,
-            func.coalesce(DagRun.end_date, current_time) <= 
func.coalesce(end_date, current_time),
-        )
+    dag_run_date_filter = (
+        func.coalesce(DagRun.start_date, current_time) >= start_date,
+        func.coalesce(DagRun.end_date, current_time) <= 
func.coalesce(end_date, current_time),
+    )

Review Comment:
   @viiccwen thanks, makes sense. I see @iharsh02 has already created merge 
request for the same. Apologies I missed the tag for the issue in the comment.



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