o-nikolas commented on code in PR #60357:
URL: https://github.com/apache/airflow/pull/60357#discussion_r2677955316
##########
airflow-core/src/airflow/executors/base_executor.py:
##########
@@ -281,22 +285,12 @@ def _emit_metrics(self, open_slots, num_running_tasks,
num_queued_tasks):
"""
name = self.__class__.__name__
multiple_executors_configured =
len(ExecutorLoader.get_executor_names()) > 1
- if multiple_executors_configured:
- metric_suffix = name
- open_slots_metric_name = (
- f"executor.open_slots.{metric_suffix}" if
multiple_executors_configured else "executor.open_slots"
- )
- queued_tasks_metric_name = (
- f"executor.queued_tasks.{metric_suffix}"
- if multiple_executors_configured
- else "executor.queued_tasks"
- )
- running_tasks_metric_name = (
- f"executor.running_tasks.{metric_suffix}"
- if multiple_executors_configured
- else "executor.running_tasks"
- )
+ metric_suffix = name if multiple_executors_configured else None
Review Comment:
Why not just compute metric_suffix within _get_metric_name? So that you
don't have to pass it in every time? If a method call takes a arg every single
call it might as well just own it.
--
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]