|
@ -56,7 +56,10 @@ module Semantic |
|
|
status = ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class_name) |
|
|
status = ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class_name) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
additions << pop_active_record_summary |
|
|
additions << "GC: #{event.gc_time.round(1)}ms" |
|
|
additions << "GC: #{event.gc_time.round(1)}ms" |
|
|
|
|
|
additions.compact! |
|
|
|
|
|
|
|
|
if event.duration >= 1200 |
|
|
if event.duration >= 1200 |
|
|
logger.error process_duration(event, additions) |
|
|
logger.error process_duration(event, additions) |
|
|
elsif event.duration >= 600 |
|
|
elsif event.duration >= 600 |
|
@ -92,6 +95,21 @@ module Semantic |
|
|
|
|
|
|
|
|
private |
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
def pop_active_record_summary |
|
|
|
|
|
active_record_transactions = Thread.current[ActiveRecord.to_s] |
|
|
|
|
|
return unless active_record_transactions |
|
|
|
|
|
|
|
|
|
|
|
# reset thread local |
|
|
|
|
|
Thread.current[ActiveRecord.to_s] = nil |
|
|
|
|
|
|
|
|
|
|
|
active_record_transactions.map do |k, art| |
|
|
|
|
|
art.except(:total_duration) |
|
|
|
|
|
.select { |_, value| value.positive? } |
|
|
|
|
|
.map { |k, v| "#{v} #{k.to_s.pluralize(v)}" } |
|
|
|
|
|
.join(',') |
|
|
|
|
|
end.compact.join('|') |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
def redirect_regex |
|
|
def redirect_regex |
|
|
return @redirect_regex if defined?(@redirect_regex) |
|
|
return @redirect_regex if defined?(@redirect_regex) |
|
|
|
|
|
|
|
|