You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "gopidesupavan (via GitHub)" <gi...@apache.org> on 2026/01/09 23:02:16 UTC
[PR] Simplify metric names construction in BaseExecutor emit_metrics [airflow]
gopidesupavan opened a new pull request, #60357:
URL: https://github.com/apache/airflow/pull/60357
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull request.
Write a good git commit message following this guide: http://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the documentation.
Feel free to ping (in general) for the review if you do not see reaction for a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
## Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR, please
change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
-->
- [ ] Yes (please specify the tool below)
<!--
Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
---
* Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
* For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment: `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Simplify metric names construction in BaseExecutor emit_metrics [airflow]
Posted by "gopidesupavan (via GitHub)" <gi...@apache.org>.
gopidesupavan merged PR #60357:
URL: https://github.com/apache/airflow/pull/60357
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Simplify metric names construction in BaseExecutor emit_metrics [airflow]
Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Simplify metric names construction in BaseExecutor emit_metrics [airflow]
Posted by "gopidesupavan (via GitHub)" <gi...@apache.org>.
gopidesupavan commented on code in PR #60357:
URL: https://github.com/apache/airflow/pull/60357#discussion_r2678537300
##########
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:
updated..:)
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org