Sha256: ed027e4c1ca311745dfbcb1e470fa3360240b09ce48b02b520d4f83a0632bc46

Contents?: true

Size: 486 Bytes

Versions: 3

Compression:

Stored size: 486 Bytes

Contents

::Mysql2::Client.class_eval do
  alias_method :query_without_tracebin, :query

  def query(*args, &block)
    start_time   = ::Tracebin::PatchHelper.timestamp_string
    result       = query_without_tracebin(*args, &block)
    end_time     = ::Tracebin::PatchHelper.timestamp_string

    event_data = [
      'sql.mysql2_query',
      start_time,
      end_time,
      {
        sql: args[0]
      }
    ]

    ::Tracebin::Patches.handle_event :mysql2, event_data

    result
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tracebin-0.0.13 lib/tracebin/patches/mysql2.rb
tracebin-0.0.12 lib/tracebin/patches/mysql2.rb
tracebin-0.0.11 lib/tracebin/patches/mysql2.rb