Set arrival timestamp for timer trigger events

By addding timer trigger events directly to the pipeline event queues
(added in I6b4b77a82aac6d2c3441ace9f64dc9b4a80c5856) we no longer use
the `addTriggerEvent()` method of the scheduler which was setting the
`arrived_at_scheduler_timestamp` of the event.

This will lead to an exception when reporting pipeline stats for the
added item:

ERROR zuul.Pipeline.tenant.periodic_5_min: Exception reporting pipeline stats
Traceback (most recent call last):
  File "/opt/zuul/lib/python3.10/site-packages/zuul/manager/__init__.py", line 2208, in reportStats
    processing = (now - arrived) * 1000
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

This changes sets the missing timestamp when creating the event in the
timer driver.

Change-Id: Ic6fe39637935405dd0df6c9bac2e3bf313656a63
This commit is contained in:
Simon Westphahl 2023-01-26 08:45:55 +01:00
parent bc06b0851c
commit 09f705d968
No known key found for this signature in database

View File

@ -226,6 +226,7 @@ class TimerDriver(Driver, TriggerInterface):
event.branch = branch
event.zuul_event_id = str(uuid4().hex)
event.timestamp = time.time()
event.arrived_at_scheduler_timestamp = event.timestamp
# Refresh the branch in order to update the item in the
# change cache.
change_key = project.source.getChangeKey(event)