Module: NewRelic::Agent::Instrumentation::RackHelpers

Defined in:
lib/new_relic/agent/instrumentation/rack/helpers.rb

Class Method Summary collapse

Class Method Details

.middleware_instrumentation_enabled?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/new_relic/agent/instrumentation/rack/helpers.rb', line 29

def self.middleware_instrumentation_enabled?
  version_supported? && !::NewRelic::Agent.config[:disable_middleware_instrumentation]
end

.puma_rack_version_supported?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
27
# File 'lib/new_relic/agent/instrumentation/rack/helpers.rb', line 19

def self.puma_rack_version_supported?
  return false unless defined? ::Puma::Const::PUMA_VERSION

  version = Gem::Version.new(::Puma::Const::PUMA_VERSION)
  # TODO: MAJOR VERSION - update min_version to 3.9.0
  # min_version = Gem::Version.new('3.9.0')
  min_version = Gem::Version.new('2.12.0')
  version >= min_version
end

.rack_version_supported?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
# File 'lib/new_relic/agent/instrumentation/rack/helpers.rb', line 11

def self.rack_version_supported?
  return false unless defined? ::Rack

  version = Gem::Version.new(::Rack.release)
  min_version = Gem::Version.new('1.1.0')
  version >= min_version
end

.version_supported?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/new_relic/agent/instrumentation/rack/helpers.rb', line 7

def self.version_supported?
  rack_version_supported? || puma_rack_version_supported?
end