Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable already existing "task.scheduled_duration" metric #46009

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

AutomationDev85
Copy link
Contributor

Overview

This PR enables the task.scheduled_duration metric. It is already described here:
https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/logging-monitoring/metrics.html#timers
Search for "task.scheduled_duration"
The metric is not working at the moment as the scheduled_dttm field is missing in the task_instance table.

I hope I catched all points in the code were the task_instance is set to scheduled state to collect the right time and that I understood the metric in the right way.
Idea of this PR to keep it as simple as possible to enable this metric.

Details of changes:

  • Add scheduled_dttm field to the task_instance table.
  • Setting scheduled_dttm field if task is set to scheduled state.
  • Enable metric calcuation.
  • Update the api to return the task_instance with the new field.

Looking forward to start the discussion about this metric and getting this live with Airflow 3.

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:db-migrations PRs with DB migration area:Scheduler including HA (high availability) scheduler area:Triggerer area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues kind:documentation labels Jan 24, 2025
@jscheffl jscheffl added the legacy api Whether legacy API changes should be allowed in PR label Jan 24, 2025
@jscheffl jscheffl closed this Jan 24, 2025
@jscheffl jscheffl reopened this Jan 24, 2025
@jscheffl jscheffl requested a review from Copilot January 24, 2025 15:08

Choose a reason for hiding this comment

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

Copilot reviewed 8 out of 23 changed files in this pull request and generated no comments.

Files not reviewed (15)
  • airflow/api_fastapi/core_api/openapi/v1-generated.yaml: Language not supported
  • docs/apache-airflow/img/airflow_erd.sha256: Language not supported
  • docs/apache-airflow/migrations-ref.rst: Language not supported
  • airflow/api_fastapi/core_api/datamodels/task_instances.py: Evaluated as low risk
  • airflow/api_connexion/schemas/task_instance_schema.py: Evaluated as low risk
  • tests/api_connexion/endpoints/test_task_instance_endpoint.py: Evaluated as low risk
  • airflow/models/dag.py: Evaluated as low risk
  • tests/api_connexion/schemas/test_task_instance_schema.py: Evaluated as low risk
  • airflow/models/dagrun.py: Evaluated as low risk
  • airflow/models/taskinstancehistory.py: Evaluated as low risk
  • tests/api_connexion/endpoints/test_mapped_task_instance_endpoint.py: Evaluated as low risk
  • airflow/models/taskinstance.py: Evaluated as low risk
  • tests/api_fastapi/core_api/routes/public/test_task_instances.py: Evaluated as low risk
  • airflow/models/trigger.py: Evaluated as low risk
  • airflow/triggers/base.py: Evaluated as low risk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:API Airflow's REST/HTTP API area:db-migrations PRs with DB migration area:Scheduler including HA (high availability) scheduler area:Triggerer area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues kind:documentation legacy api Whether legacy API changes should be allowed in PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants