Sha256: ca2ccc70cb5c815e577da580c5b4c0fb7a6b67faf6bf843d881fe8558313b6fa

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

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

DependencyDetection.defer do
  @name = :sunspot

  depends_on do
    defined?(Sunspot)
  end

  executes do
    NewRelic::Agent.logger.info('Installing Rails Sunspot instrumentation')
    deprecation_msg = 'The instrumentation for Sunspot is deprecated. ' \
      'It will be removed in version 9.0.0.'

    NewRelic::Agent.logger.log_once(
      :warn,
      :deprecated_sunspot,
      deprecation_msg
    )
  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

3 entries across 3 versions & 1 rubygems

Version Path
newrelic_rpm-8.16.0 lib/new_relic/agent/instrumentation/sunspot.rb
newrelic_rpm-8.15.0 lib/new_relic/agent/instrumentation/sunspot.rb
newrelic_rpm-8.14.0 lib/new_relic/agent/instrumentation/sunspot.rb