Sha256: be4b2b9d1a1801518052be4eed602581b76bba40ce5af58d31fb34e1a6479d22

Contents?: true

Size: 416 Bytes

Versions: 1

Compression:

Stored size: 416 Bytes

Contents

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

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

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

    ::Vizsla::Patches.handle_event :mysql2, event_data

    result
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tracebin-0.0.7 lib/vizsla/patches/mysql2.rb