Skip to content

Add team_name to Multi-Team metrics - #68108

Merged
ferruzzi merged 4 commits into
apache:mainfrom
aws-mwaa:ferruzzi/multi-team/metrics
Jun 10, 2026
Merged

ferruzzi merged 4 commits into
apache:mainfrom
aws-mwaa:ferruzzi/multi-team/metrics

Conversation

@ferruzzi

@ferruzzi ferruzzi commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

Add team_name to ~35 metrics (DagRun, TaskInstance, pool slots) for multi-team Airflow deployments. When multi_team is disabled or a DAG has no team, the tag is omitted entirely (no change to existing systems).

Changes:

  • Add team_name to DagRun.stats_tags and TaskInstance.stats_tags
  • Set _team_name on DagRun/TI objects in 4 scheduler injection points
  • Add persistent _dag_id_to_team_name cache on SchedulerJobRunner
  • Add stats_tags property to RuntimeTaskInstance (Task SDK)
  • Add team_name to pool slot gauge metrics via pool.get_name_to_team_name_mapping

Remaining metrics will be done in (6 or 7?) parallel chunks after this lands.

Co-authored-by: Niko Oliveira onikolas@amazon.com


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

Comment thread airflow-core/src/airflow/jobs/scheduler_job_runner.py
@ferruzzi
ferruzzi force-pushed the ferruzzi/multi-team/metrics branch from a65c4cc to 30b8c42 Compare June 8, 2026 19:52
Comment thread airflow-core/src/airflow/models/dagrun.py Outdated
@ferruzzi
ferruzzi force-pushed the ferruzzi/multi-team/metrics branch from 30b8c42 to 96763f1 Compare June 8, 2026 21:24
ferruzzi and others added 2 commits June 9, 2026 12:42
Add `team_name` to ~35 metrics (DagRun, TaskInstance, pool slots) for multi-team Airflow deployments. When multi_team is disabled or a DAG has no team, the tag is omitted entirely (no change to existing systems).

Changes:
- Add `team_name` to `DagRun.stats_tags` and `TaskInstance.stats_tags`
- Set `_team_name` on `DagRun`/`TI` objects in 4 scheduler injection points
- Add persistent `_dag_id_to_team_name` cache on `SchedulerJobRunner`
- Add `stats_tags` property to `RuntimeTaskInstance` (Task SDK)
- Add `team_name` to pool slot gauge metrics via `pool.get_name_to_team_name_mapping`

Co-authored-by: Niko Oliveira <onikolas@amazon.com>
@ferruzzi
ferruzzi force-pushed the ferruzzi/multi-team/metrics branch from 2e0ee44 to b3f1c00 Compare June 9, 2026 20:48

@o-nikolas o-nikolas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, just some minor nits/comments

Comment thread airflow-core/src/airflow/jobs/scheduler_job_runner.py Outdated
Comment thread airflow-core/src/airflow/jobs/scheduler_job_runner.py
Comment thread airflow-core/src/airflow/jobs/scheduler_job_runner.py
dingo4dev pushed a commit to dingo4dev/airflow that referenced this pull request Jun 16, 2026
* Add team_name to Multi-Team metrics

Add `team_name` to ~35 metrics (DagRun, TaskInstance, pool slots) for multi-team Airflow deployments. When multi_team is disabled or a DAG has no team, the tag is omitted entirely (no change to existing systems).

Changes:
- Add `team_name` to `DagRun.stats_tags` and `TaskInstance.stats_tags`
- Set `_team_name` on `DagRun`/`TI` objects in 4 scheduler injection points
- Add persistent `_dag_id_to_team_name` cache on `SchedulerJobRunner`
- Add `stats_tags` property to `RuntimeTaskInstance` (Task SDK)
- Add `team_name` to pool slot gauge metrics via `pool.get_name_to_team_name_mapping`

Co-authored-by: Niko Oliveira <onikolas@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants