Aaryan123456679 commented on code in PR #69270:
URL: https://github.com/apache/airflow/pull/69270#discussion_r3645225885


##########
airflow-core/newsfragments/69270.bugfix.rst:
##########


Review Comment:
   Removed.



##########
airflow-core/src/airflow/observability/metrics/stats_utils.py:
##########
@@ -37,3 +37,21 @@ def get_stats_factory() -> Callable:
 
         return otel_logger.get_otel_logger
     return NoStatsLogger
+
+
+def initialize_sdk_stats_backend() -> None:
+    """
+    Initialize the task-sdk ``Stats`` singleton with this process's configured 
backend.
+
+    Plugins and listener hooks commonly get ``Stats`` via 
``airflow.sdk.observability.stats``
+    (or the deprecated ``airflow.stats`` shim, which re-exports the same 
module). That module
+    is a separate singleton from the one this process initializes for its own 
internal use, so
+    it must be initialized here too, or plugin code silently falls back to 
``NoStatsLogger`` in
+    any long-running component other than the task runner.
+    """
+    from airflow.sdk.observability import stats as sdk_stats  # noqa: SDK001

Review Comment:
   Removed the airflow.sdk import from core entirely. initialize() in 
shared/observability now propagates the configuration to any sibling copy of 
the stats module already loaded under a different distribution path (e.g. 
airflow._shared vs airflow.sdk._shared), so core no longer needs to reach into 
the sdk client to configure the plugin-facing singleton.



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