5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/txnap/formatter.rb', line 5
def call(report)
gap = report.longest_gap
lines = [
"Txnap::IdleGapDetected",
"",
"Transaction held for #{milliseconds(report.transaction_duration)} ms (BEGIN → #{report.outcome.to_s.upcase})",
"Database time: #{milliseconds(report.database_time)} ms",
"Longest non-database gap: #{milliseconds(gap.duration)} ms",
"",
"Gap occurred between:",
" after: #{event(gap.after)}",
" before: #{event(gap.before)}"
]
append_locks(lines, report.locks)
lines.concat([
"",
"Move slow non-database work (I/O, rendering, external calls,",
"heavy computation) outside the transaction."
])
lines.join("\n")
end
|