xBis7 commented on code in PR #61812:
URL: https://github.com/apache/airflow/pull/61812#discussion_r2811601609


##########
providers/edge3/src/airflow/providers/edge3/worker_api/routes/jobs.py:
##########
@@ -87,8 +87,6 @@ def fetch(
     # Edge worker does not backport emitted Airflow metrics, so export some 
metrics
     tags = {"dag_id": job.dag_id, "task_id": job.task_id, "queue": job.queue}
     try:
-        from airflow.sdk._shared.observability.metrics.dual_stats_manager 
import DualStatsManager
-
         DualStatsManager.incr("edge_worker.ti.start", tags=tags)

Review Comment:
   I think that this pattern won't work for backwards compatibility.
   
   ```
   from airflow.providers.common.compat.sdk import DualStatsManager
   
   try:
       DualStatsManager.incr(...)
   except ImportError:
       Stats.incr(...)
   ```
   
   
   
https://github.com/apache/airflow/actions/runs/21948998472/job/63395314623?pr=61812#step:13:4273
   
   
   The `DualStatsManager` is very new and it was directly added under `shared`. 
If we run this provider version with an older core/shared version, then the 
import itself
   ```
   from airflow.providers.common.compat.sdk import DualStatsManager
   ```
   
   will throw the `ImportError`. It won't get to `DualStatsManager.incr(...)`.
   
   For example, `Stats` existed in airflow 2.11 as well but `DualStatsManager` 
didn't. None of these will work with 2.11
   ```
       "DualStatsManager": (
           "airflow.sdk._shared.observability.metrics.dual_stats_manager",
           "airflow._shared.observability.metrics.dual_stats_manager",
       ),
   ```
   
https://github.com/apache/airflow/pull/61812/changes#diff-6a680f957b3afb33b52ff95521bb5490ff293442aece283694afddfe0a884ae8R278-R281



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