Sha256: 91b66d6cd69fd233ce94902d5df73ba4c80249e6979797a7a7d043348769de80

Contents?: true

Size: 1.35 KB

Versions: 20

Compression:

Stored size: 1.35 KB

Contents

# -*- ruby -*-
# 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 = :sequel

  depends_on do
    defined?(Sequel)
  end

  depends_on do
    !NewRelic::Agent.config[:disable_sequel_instrumentation]
  end

  def supported_sequel_version?
    Sequel.const_defined?(:MAJOR) &&
      (Sequel::MAJOR > 3 ||
        Sequel::MAJOR == 3 && Sequel::MINOR >= 37)
  end

  executes do
    if supported_sequel_version?

      NewRelic::Agent.logger.info('Installing Sequel instrumentation')

      if Sequel::Database.respond_to?(:extension)
        Sequel::Database.extension(:new_relic_instrumentation)
      else
        NewRelic::Agent.logger.info('Detected Sequel version %s.' % [Sequel::VERSION])
        NewRelic::Agent.logger.info('Please see additional documentation: ' +
          'https://docs.newrelic.com/docs/apm/agents/ruby-agent/frameworks/sequel-instrumentation/')
      end

      Sequel.synchronize { Sequel::DATABASES.dup }.each do |db|
        db.extension(:new_relic_instrumentation)
      end

      Sequel::Model.plugin(:new_relic_instrumentation) if defined?(Sequel::Model)
    else

      NewRelic::Agent.logger.info('Sequel instrumentation requires at least version 3.37.0.')

    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
newrelic_rpm-9.17.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.16.1 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.16.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.15.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.14.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.13.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.12.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.11.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.10.2 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.10.1 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.10.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.9.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.8.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.7.1 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.7.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.6.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.5.0 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.4.2 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.4.1 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-9.4.0 lib/new_relic/agent/instrumentation/sequel.rb