Sha256: 332e3a33a3253f5d4a3ad7e7c527b3e2425c4768429a907a03c68fb770702918

Contents?: true

Size: 1.35 KB

Versions: 34

Compression:

Stored size: 1.35 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.

require 'newrelic_rpm'

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

    else

      NewRelic::Agent.logger.info "Sequel instrumentation requires at least version 3.37.0."

    end

  end

end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
newrelic_rpm-3.12.0.288 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.11.2.286 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.11.1.284 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.11.0.283 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.10.0.279 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.9.9.275 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.9.8.273 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.9.7.266 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.9.6.257 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.9.5.251 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.9.4.245 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.9.3.241 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.9.2.239 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.9.1.236 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.9.0.229 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.8.1.221 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.8.0.218 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.7.3.204 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.7.3.199 lib/new_relic/agent/instrumentation/sequel.rb
newrelic_rpm-3.7.2.195 lib/new_relic/agent/instrumentation/sequel.rb