SameerMesiah97 opened a new pull request, #69046:
URL: https://github.com/apache/airflow/pull/69046

   **Description**
   
   This change adds a `team_name` tag to Kubernetes executor metrics to improve 
per-team observability in multi-team deployments.
   
   The following metrics now include the `team_name` tag when the executor is 
configured with a team:
   
   * `kubernetes_executor.pod_creation`
   * `kubernetes_executor.pod_deletion`
   * `kubernetes_executor.pod_patching`
   * `kubernetes_executor.adopt_task_instances.duration`
   * `kubernetes_executor.pod_creation_status`
   * `kubernetes_executor.pod_deletion_status`
   * `kubernetes_executor.pod_patching_status`
   
   The metric `kubernetes_executor.clear_not_launched_queued_tasks.duration` 
was not updated because it is no longer present in the current Kubernetes 
executor implementation.
   
   With the exception of `kubernetes_executor.adopt_task_instances.duration`, 
all of the above metrics are emitted from `AirflowKubernetesScheduler`.
   
   **Rationale**
   
   The Kubernetes executor supports multi-team scheduling, but its operational 
metrics could not previously be attributed to individual teams. Adding the 
`team_name` tag enables per-team dashboards, alerting, and troubleshooting 
while remaining backwards compatible for deployments that do not use teams.
   
   **Notes**
   
   **`team_name` is owned by `KubernetesExecutor`, while most of the affected 
metrics are emitted from `AirflowKubernetesScheduler`. To allow 
scheduler-emitted metrics to include the `team_name` tag, the value is passed 
to `AirflowKubernetesScheduler` when it is constructed by the executor.**
   
   **Tests**
   
   Updated the existing unit tests for `kubernetes_executor.pod_deletion` and 
`kubernetes_executor.pod_deletion_status` to verify metrics are emitted both 
with and without the `team_name` tag.
   
   Also updated the existing `test_gauge_executor_metrics` test to verify that 
the executor's gauge metrics (`executor.open_slots`, `executor.queued_tasks`, 
and `executor.running_tasks`) continue to emit the expected tags, including 
`team_name` when configured.
   
   The following metrics do not currently have dedicated unit test coverage, so 
no additional tests were added for them as part of this change:
   
   * `kubernetes_executor.pod_creation`
   * `kubernetes_executor.pod_creation_status`
   * `kubernetes_executor.pod_patching`
   * `kubernetes_executor.pod_patching_status`
   * `kubernetes_executor.adopt_task_instances.duration`
   
   **Backwards Compatibility**
   
   This change is additive only. Existing metric names remain unchanged, and 
the `team_name` tag is emitted only when the Kubernetes executor is configured 
with a team. Existing dashboards and integrations that do not use the new tag 
continue to function unchanged.
   
   Related: #68996
   
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: [GPT 5.5] following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


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