Sha256: aa87e26437bc296506e1ef89622d9bc44de3cff3e99e6384ac7c421edcce08e1

Contents?: true

Size: 1.36 KB

Versions: 13

Compression:

Stored size: 1.36 KB

Contents

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

DependencyDetection.defer do
  @name = :sequel

  depends_on do
    defined?(::Sequel)
  end

  depends_on do
    !NewRelic::Agent.config[:disable_sequel_instrumentation] &&
    !NewRelic::Agent.config[:disable_database_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 :newrelic_instrumentation
      else
        NewRelic::Agent.logger.info "Detected Sequel version %s." % [ Sequel::VERSION ]
        NewRelic::Agent.logger.info "Please see additional documentation: " +
          "https://newrelic.com/docs/ruby/sequel-instrumentation"
      end

      Sequel.synchronize{Sequel::DATABASES.dup}.each do |db|
        db.extension :newrelic_instrumentation
      end

      Sequel::Model.plugin(:newrelic_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

13 entries across 13 versions & 1 rubygems

Version Path
newrelic_rpm-6.11.0.365 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-6.10.0.364 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-6.9.0.363 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-6.8.0.360 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-6.7.0.359 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-6.6.0.358 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-6.5.0.357 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-6.4.0.356 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-6.3.0.355 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-6.2.0.354 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-6.1.0.352 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-6.0.0.351 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-5.7.0.350 lib/new_relic/agent/instrumentation/sequel.rb