nailo2c commented on code in PR #52815:
URL: https://github.com/apache/airflow/pull/52815#discussion_r2328874618


##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -1014,6 +1018,13 @@ def prepare_file_queue(self, known_files: dict[str, 
set[DagFileInfo]]):
         self._add_files_to_queue(to_queue, False)
         Stats.incr("dag_processing.file_path_queue_update_count")
 
+    def _emit_running_dags_metric(self):
+        """Emit executor.running_dags gauge."""
+        with create_session() as session:
+            stmt = select(func.count()).select_from(DagRun).where(DagRun.state 
== DagRunState.RUNNING)
+            running_dags = session.scalar(stmt)
+            Stats.gauge("executor.running_dags", running_dags)
+

Review Comment:
   Thanks for the review! I've added a check for the metrics settings and now 
skip the query if none are enabled. PTAL :)



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to