Skip to content

Commit f79f96c

Browse files
committed
reporter: report timings of flaky jobs
Makes it easier to understand the impact on the build time.
1 parent d7f08d7 commit f79f96c

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/rspecq/queue.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ def record_build_timing(job, duration)
250250
@redis.zadd(key_build_timings, duration, job)
251251
end
252252

253+
def job_build_timing(job)
254+
@redis.zscore(key_build_timings, job)
255+
end
256+
253257
# Persist build timings to the global timings key, so that they can be
254258
# used for scheduling future builds.
255259
def update_global_timings(dst = key_timings)

lib/rspecq/reporter.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,13 @@ def summary(failures, errors, flaky_jobs)
145145
summary << "\n\n"
146146
summary << "Flaky jobs detected (count=#{flaky_jobs.count}):\n"
147147
flaky_jobs.each do |j|
148+
job_timing = if (jt = @queue.job_build_timing(j))
149+
humanize_duration(jt.to_i)
150+
else
151+
"---"
152+
end
148153
summary << RSpec::Core::Formatters::ConsoleCodes.wrap(
149-
"#{@queue.job_location(j)} @ #{@queue.failed_job_worker(j)}\n",
154+
"#{@queue.job_location(j)} @ #{@queue.failed_job_worker(j)} timing=#{job_timing}\n",
150155
RSpec.configuration.pending_color
151156
)
152157

0 commit comments

Comments
 (0)