You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Trigger queue delay metric can become negative after system clock adjustments #69970
The triggerer.trigger_queue_delay metric measures the duration between the TriggerRunnerSupervisor queueing a trigger workload and the TriggerRunner creating the trigger. Both timestamps currently use time.time().
If NTP, virtualization, or an administrator adjusts the system clock between those operations, the metric can become negative or be inflated even though the actual queue delay is normal.
Minimal reproduction:
Create a trigger workload with queued_at=100.0.
Simulate the wall clock moving backward so that time.time() returns 90.0 when the TriggerRunner creates the trigger.
Observe that the emitted queue delay is -10000 milliseconds.
This can also be reproduced in the existing test_create_triggers_emits_queue_delay_metric test by setting the workload's queue timestamp to 100.0, mocking time.time() to return 90.0, and expecting the real elapsed delay from a stable clock.
What you think should happen instead?
Queue delay is a duration and should use time.monotonic() at both the producer and consumer ends. System wall-clock djustments should not affect the emitted metric.
Operating System
No response
Deployment
None
Apache Airflow Provider(s)
No response
Versions of Apache Airflow Providers
No response
Official Helm Chart version
Not Applicable
Kubernetes Version
No response
Helm Chart configuration
No response
Docker Image customizations
No response
Anything else?
The metric was introduced by #67927. A tested fix is ready that changes both timestamp sites to time.monotonic() and adds regression coverage for a backward wall-clock adjustment.
Activity