You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ra...@apache.org on 2026/03/03 05:13:16 UTC
(airflow) branch backport-61824 created (now 7b5362c53a6)
This is an automated email from the ASF dual-hosted git repository.
rahulvats pushed a change to branch backport-61824
in repository https://gitbox.apache.org/repos/asf/airflow.git
at 7b5362c53a6 Fix timer.duration unit labels in logs (#61824)
This branch includes the following new commits:
new 7b5362c53a6 Fix timer.duration unit labels in logs (#61824)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(airflow) 01/01: Fix timer.duration unit labels in logs (#61824)
Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rahulvats pushed a commit to branch backport-61824
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 7b5362c53a6ef07aec369c507910f67bb88090df
Author: Jed Cunningham <66...@users.noreply.github.com>
AuthorDate: Fri Feb 13 00:20:11 2026 -0700
Fix timer.duration unit labels in logs (#61824)
Update timer.duration labels and examples to milliseconds, and fix the
OTel timing docstring to match runtime behavior.
Historical context: #39908 introduced milliseconds alignment with a
compatibility flag, and #43975 removed that flag and standardized
milliseconds everywhere.
Co-authored-by: Cursor <cu...@cursor.com>
(cherry picked from commit 10dcb3a55200fa34e754769bd106a3f71280a8b0)
---
airflow-core/src/airflow/jobs/scheduler_job_runner.py | 4 ++--
airflow-core/src/airflow/metrics/otel_logger.py | 2 +-
airflow-core/src/airflow/plugins_manager.py | 2 +-
airflow-core/src/airflow/serialization/serde.py | 2 +-
contributing-docs/05_pull_requests.rst | 2 +-
task-sdk/src/airflow/sdk/io/fs.py | 2 +-
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/airflow-core/src/airflow/jobs/scheduler_job_runner.py b/airflow-core/src/airflow/jobs/scheduler_job_runner.py
index 81cce651435..53baf765bb2 100644
--- a/airflow-core/src/airflow/jobs/scheduler_job_runner.py
+++ b/airflow-core/src/airflow/jobs/scheduler_job_runner.py
@@ -1419,12 +1419,12 @@ class SchedulerJobRunner(BaseJobRunner, LoggingMixin):
next_event = timers.run(blocking=False)
self.log.debug("Next timed event is in %f", next_event)
- self.log.debug("Ran scheduling loop in %.2f seconds", timer.duration)
+ self.log.debug("Ran scheduling loop in %.2f ms", timer.duration)
if span.is_recording():
span.add_event(
name="Ran scheduling loop",
attributes={
- "duration in seconds": timer.duration,
+ "duration in ms": timer.duration,
},
)
diff --git a/airflow-core/src/airflow/metrics/otel_logger.py b/airflow-core/src/airflow/metrics/otel_logger.py
index 6b75428529c..ef4837f46d7 100644
--- a/airflow-core/src/airflow/metrics/otel_logger.py
+++ b/airflow-core/src/airflow/metrics/otel_logger.py
@@ -272,7 +272,7 @@ class SafeOtelLogger:
*,
tags: Attributes = None,
) -> None:
- """OTel does not have a native timer, stored as a Gauge whose value is number of seconds elapsed."""
+ """OTel does not have a native timer, stored as a Gauge whose value is elapsed ms."""
if self.metrics_validator.test(stat) and name_is_otel_safe(self.prefix, stat):
if isinstance(dt, datetime.timedelta):
dt = dt.total_seconds() * 1000.0
diff --git a/airflow-core/src/airflow/plugins_manager.py b/airflow-core/src/airflow/plugins_manager.py
index 6f74a8e958f..0f940a42881 100644
--- a/airflow-core/src/airflow/plugins_manager.py
+++ b/airflow-core/src/airflow/plugins_manager.py
@@ -360,7 +360,7 @@ def ensure_plugins_loaded():
load_providers_plugins()
if plugins:
- log.debug("Loading %d plugin(s) took %.2f seconds", len(plugins), timer.duration)
+ log.debug("Loading %d plugin(s) took %.2f ms", len(plugins), timer.duration)
def initialize_ui_plugins():
diff --git a/airflow-core/src/airflow/serialization/serde.py b/airflow-core/src/airflow/serialization/serde.py
index 6faedd88417..1615f3bd752 100644
--- a/airflow-core/src/airflow/serialization/serde.py
+++ b/airflow-core/src/airflow/serialization/serde.py
@@ -390,7 +390,7 @@ def _register():
log.debug("registering %s for stringifying", c)
_stringifiers[c] = name
- log.debug("loading serializers took %.3f seconds", timer.duration)
+ log.debug("loading serializers took %.3f ms", timer.duration)
@functools.cache
diff --git a/contributing-docs/05_pull_requests.rst b/contributing-docs/05_pull_requests.rst
index 3570ff55bb0..a7890192adf 100644
--- a/contributing-docs/05_pull_requests.rst
+++ b/contributing-docs/05_pull_requests.rst
@@ -324,7 +324,7 @@ or to time but not send a metric:
with Stats.timer() as timer:
...
- log.info("Code took %.3f seconds", timer.duration)
+ log.info("Code took %.3f ms", timer.duration)
For full docs on ``timer()`` check out `airflow/stats.py`_.
diff --git a/task-sdk/src/airflow/sdk/io/fs.py b/task-sdk/src/airflow/sdk/io/fs.py
index a49d7c6ffcc..f1484537cc8 100644
--- a/task-sdk/src/airflow/sdk/io/fs.py
+++ b/task-sdk/src/airflow/sdk/io/fs.py
@@ -67,7 +67,7 @@ def _register_filesystems() -> Mapping[
raise ImportError(f"Filesystem {fs_module_name} does not have a get_fs method")
scheme_to_fs[scheme] = method
- log.debug("loading filesystems from providers took %.3f seconds", timer.duration)
+ log.debug("loading filesystems from providers took %.3f ms", timer.duration)
return scheme_to_fs