Sha256: 8a99ae27547b058427788fb2bdd89ce1996274a57d9f538bd435c8599d26dc80

Contents?: true

Size: 935 Bytes

Versions: 4

Compression:

Stored size: 935 Bytes

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.

DependencyDetection.defer do
  @name = :sunspot

  depends_on do
    defined?(::Sunspot)
  end

  executes do
    ::NewRelic::Agent.logger.info 'Installing Rails Sunspot instrumentation'
  end

  executes do
    ::Sunspot.module_eval do
      class << self
        %w[index index!].each do |method|
          add_method_tracer method, 'SolrClient/Sunspot/index'
        end
        add_method_tracer :commit, 'SolrClient/Sunspot/commit'

        %w[search more_like_this].each do |method|
          add_method_tracer method, 'SolrClient/Sunspot/query'
        end
        %w[remove remove! remove_by_id remove_by_id! remove_all remove_all!].each do |method|
          add_method_tracer method, 'SolrClient/Sunspot/delete'
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
newrelic_rpm-8.6.0 lib/new_relic/agent/instrumentation/sunspot.rb
newrelic_rpm-8.5.0 lib/new_relic/agent/instrumentation/sunspot.rb
newrelic_rpm-8.4.0 lib/new_relic/agent/instrumentation/sunspot.rb
newrelic_rpm-8.3.0 lib/new_relic/agent/instrumentation/sunspot.rb