uranusjr commented on code in PR #71815:
URL: https://github.com/apache/airflow/pull/71815#discussion_r3826302425


##########
airflow-core/src/airflow/models/dagbag.py:
##########
@@ -122,8 +101,7 @@ def _read_dag(self, serdag: SerializedDagModel) -> 
SerializedDAG | None:
         with self._lock:
             self._dags[serdag.dag_version_id] = _CacheEntry(dag, 
serdag.dag_hash, time.monotonic())
             cache_size = len(self._dags)
-        if self._use_cache:
-            stats.gauge("api_server.dag_bag.cache_size", cache_size, rate=0.1)
+        self._on_cache_size(cache_size, rate=0.1)

Review Comment:
   `_on_cache_size` probably does not need to take `cache_size` at all since 
it’s always `len(self._dags)`? This would help eliminate the `len()` calls 
above when it’s not needed.



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