Sha256: ca774ea67189f824fc33aa6c7beff8fe9ea4fe335360d45ca425113fe13d2d0a

Contents?: true

Size: 1.05 KB

Versions: 34

Compression:

Stored size: 1.05 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

module NewRelic::Agent::Instrumentation
  module RackHelpers
    def self.version_supported?
      rack_version_supported? || puma_rack_version_supported?
    end

    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

    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

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

Version data entries

34 entries across 34 versions & 1 rubygems

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