ferruzzi commented on code in PR #68367:
URL: https://github.com/apache/airflow/pull/68367#discussion_r3406424201


##########
airflow-core/src/airflow/assets/manager.py:
##########
@@ -397,7 +397,12 @@ def register_asset_change(
             )
         )
 
-        stats.incr("asset.updates")
+        team_name = None
+        if task_instance and conf.getboolean("core", "multi_team"):
+            from airflow.models.dag import DagModel
+
+            team_name = DagModel.get_team_name(task_instance.dag_id, 
session=session)

Review Comment:
   Replying here so we can thread, but yeah, these should be the only Team-able 
Asset metrics.  I used `git grep -n "stats\." airflow/main -- "*.py"` to search 
the codebase which returns three possible:   
   
   ```
   $ git grep -n "stats\." airflow/main -- "*.py" | grep -i "asset"
   airflow/main:airflow-core/src/airflow/assets/manager.py:371:        
stats.incr("asset.updates")
   airflow/main:airflow-core/src/airflow/jobs/scheduler_job_runner.py:2225:     
       stats.incr("asset.triggered_dagruns")
   airflow/main:airflow-core/src/airflow/jobs/scheduler_job_runner.py:3139:     
   stats.gauge("asset.orphaned", max(getattr(deleted_orphaned_assets, 
"rowcount", 0), 0))
   ```
   
   and (unless I'm misreading something) an asset is `orphaned` because it 
doesn't have a Dag or Team, so I didn't add the team name there.  It's possible 
I'm missing the point of that metric or my search was borked, but I'm 
reasonably confident.



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