Sha256: 52ec294e9eefb5f6296f28ae421e2c04cd9b8f02e7ccdeda5715fbfd7bec0486

Contents?: true

Size: 422 Bytes

Versions: 3

Compression:

Stored size: 422 Bytes

Contents

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

  def query(*args, &block)
    start_time   = Time.now
    result       = query_without_tracebin(*args, &block)
    end_time     = Time.now

    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.10 lib/tracebin/patches/mysql2.rb
tracebin-0.0.9 lib/tracebin/patches/mysql2.rb
tracebin-0.0.8 lib/tracebin/patches/mysql2.rb