Skip to content

Fixes DagProcessor stats log | process duration changed to use time.monotonic #50316

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

Merged
merged 1 commit into from
May 8, 2025

Conversation

ayush3singh
Copy link
Contributor

@ayush3singh ayush3singh commented May 7, 2025

Fixes #50317

Why

Log statement

DAG File Processing stats captured 'Current Duration' and 'Last Duration' and was using time.time() to calculate the duration of processing a DAG , PR changed to time.monotonic() for process start_time and then the log statement stated comparing unix timestamp to monotonic counter which gave wrong stats as shown below

Screenshot 2025-05-06 at 4 07 47 PM

Fix

This Fix changes the time.time() calls to use time.monotonic() and it fixes the issue as shown below:

Screenshot 2025-05-07 at 8 54 40 AM

Copy link

boring-cyborg bot commented May 7, 2025

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@ayush3singh ayush3singh changed the title Fixes DagProcessor stats log | process duration changed to use time.monotonic Fixes 50317 DagProcessor stats log | process duration changed to use time.monotonic May 7, 2025
@ayush3singh ayush3singh changed the title Fixes 50317 DagProcessor stats log | process duration changed to use time.monotonic Fixes #50317 DagProcessor stats log | process duration changed to use time.monotonic May 7, 2025
@ayush3singh ayush3singh changed the title Fixes #50317 DagProcessor stats log | process duration changed to use time.monotonic Fixes DagProcessor stats log | process duration changed to use time.monotonic May 7, 2025
@ayush3singh ayush3singh marked this pull request as ready for review May 7, 2025 17:40
@ayush3singh
Copy link
Contributor Author

@tirkarthi Please review

Thanks for all the help

@jscheffl jscheffl added the backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch label May 8, 2025
@jscheffl jscheffl merged commit 4f4f9bd into apache:main May 8, 2025
51 checks passed
Copy link

boring-cyborg bot commented May 8, 2025

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

github-actions bot pushed a commit that referenced this pull request May 8, 2025
…time.monotonic() (#50316)

(cherry picked from commit 4f4f9bd)

Co-authored-by: ayush3singh <yesayushcan@gmail.com>
Copy link

github-actions bot commented May 8, 2025

Backport successfully created: v3-0-test

Status Branch Result
v3-0-test PR Link

github-actions bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request May 8, 2025
…time.monotonic() (apache#50316)

(cherry picked from commit 4f4f9bd)

Co-authored-by: ayush3singh <yesayushcan@gmail.com>
jscheffl pushed a commit that referenced this pull request May 8, 2025
…time.monotonic() (#50316) (#50370)

(cherry picked from commit 4f4f9bd)

Co-authored-by: ayush3singh <yesayushcan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:DAG-processing backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect DAG File Processing Stats Due to Mixing time.time() and time.monotonic() in Duration Calculation
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy