Skip to content

[CI] Fix bad timestamps being reported #130941

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 2 commits into from
Mar 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .ci/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,24 @@ def github_get_metrics(
created_at = job.created_at
started_at = job.started_at
completed_at = job.completed_at
queue_time = started_at - created_at
run_time = completed_at - started_at

# GitHub API can return results where the started_at is slightly
# later then the created_at (or completed earlier than started).
# This would cause a -23h59mn delta, which will show up as +24h
# queue/run time on grafana.
if started_at < created_at:
logging.info(
"Workflow {} started before being created.".format(task.id)
)
queue_time = datetime.timedelta(seconds=0)
else:
queue_time = started_at - created_at
if completed_at < started_at:
logging.info("Workflow {} finished before starting.".format(task.id))
run_time = datetime.timedelta(seconds=0)
else:
run_time = completed_at - started_at

if run_time.seconds == 0:
continue

Expand Down