Sha256: cd99e3b84f8561a1b0675e716d268050e8ee0db080b18e0150ca9358cd1d8148

Contents?: true

Size: 951 Bytes

Versions: 17

Compression:

Stored size: 951 Bytes

Contents

class RSolr::Connection
  alias_method :execute_without_profiling, :execute
  def execute_with_profiling(client, request_context)
    return execute_without_profiling(client, request_context) unless SqlPatches.should_measure?

    start        = Time.now
    result       = execute_without_profiling(client, request_context)
    elapsed_time = SqlPatches.elapsed_time(start)

    data = "#{request_context[:method].upcase} #{request_context[:uri]}"
    if request_context[:method] == :post and request_context[:data]
      if request_context[:headers].include?("Content-Type") and request_context[:headers]["Content-Type"] == "text/xml"
        # it's xml, unescaping isn't needed
        data << "\n#{request_context[:data]}"
      else
        data << "\n#{Rack::Utils.unescape(request_context[:data])}"
      end
    end
    ::Rack::MiniProfiler.record_sql(data, elapsed_time)

    result
  end
  alias_method :execute, :execute_with_profiling
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
panjiva-rack-mini-profiler-0.10.5.2 lib/patches/db/rsolr.rb
rack-mini-profiler-0.10.6 lib/patches/db/rsolr.rb
panjiva-rack-mini-profiler-0.10.5 lib/patches/db/rsolr.rb
rack-mini-profiler-0.10.5 lib/patches/db/rsolr.rb
rack-mini-profiler-0.10.4 lib/patches/db/rsolr.rb
rack-mini-profiler-0.10.3 lib/patches/db/rsolr.rb
rack-mini-profiler-0.10.2 lib/patches/db/rsolr.rb
rack-mini-profiler-0.10.1 lib/patches/db/rsolr.rb
rack-mini-profiler-0.9.9.2 lib/patches/db/rsolr.rb
rack-mini-profiler-0.9.9.1 lib/patches/db/rsolr.rb
rack-mini-profiler-0.9.9 lib/patches/db/rsolr.rb
rack-mini-profiler-0.9.8 lib/patches/db/rsolr.rb
rack-mini-profiler-0.9.7 lib/patches/db/rsolr.rb
rack-mini-profiler-0.9.6 lib/patches/db/rsolr.rb
rack-mini-profiler-0.9.5 lib/patches/db/rsolr.rb
rack-mini-profiler-0.9.4 lib/patches/db/rsolr.rb
rack-mini-profiler-0.9.3 lib/patches/db/rsolr.rb