Class: Mysql2::Result

Inherits:
Object
  • Object
show all
Includes:
MiniProfiler
Defined in:
lib/patches/db/mysql2/alias_method.rb,
lib/patches/db/mysql2/prepend.rb

Overview

The best kind of instrumentation is in the actual db provider, however we don’t want to double instrument

Defined Under Namespace

Modules: MiniProfiler

Instance Method Summary collapse

Instance Method Details

#each(*args, &blk) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/patches/db/mysql2/alias_method.rb', line 7

def each(*args, &blk)
  return each_without_profiling(*args, &blk) unless defined?(@miniprofiler_sql_id)

  start        = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  result       = each_without_profiling(*args, &blk)
  elapsed_time = SqlPatches.elapsed_time(start)

  @miniprofiler_sql_id.report_reader_duration(elapsed_time)
  result
end

#each_without_profilingObject



6
# File 'lib/patches/db/mysql2/alias_method.rb', line 6

alias_method :each_without_profiling, :each