Sha256: f458d6045866b0b6d24e72b8fe4d26b1735f3ea54d47443b6045776f1316b924

Contents?: true

Size: 1.07 KB

Versions: 28

Compression:

Stored size: 1.07 KB

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2016

if ::Rails::VERSION::MAJOR < 3
  ::Rails.configuration.after_initialize do
    if ::Instana.config[:tracing][:enabled]
      ::Instana.logger.debug "Instrumenting Rack"
      ::Rails.configuration.middleware.insert 0, ::Instana::Rack
    else
      ::Instana.logger.info "Rack: Tracing disabled via config.  Not enabling middleware."
    end
  end
else
  module ::Instana
    class Railtie < ::Rails::Railtie
      initializer 'instana.rack' do |app|
        # Configure the Instrumented Logger
        if ::Instana.config[:logging][:enabled] && !ENV.key?('INSTANA_TEST')
          logger = ::Instana::InstrumentedLogger.new('/dev/null')
          Rails.logger.extend(ActiveSupport::Logger.broadcast(logger))
        end

        if ::Instana.config[:tracing][:enabled]
          ::Instana.logger.debug "Instrumenting Rack"
          app.config.middleware.insert 0, ::Instana::Rack
        else
          ::Instana.logger.info "Rack: Tracing disabled via config.  Not enabling middleware."
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
instana-1.204.0 lib/instana/frameworks/rails.rb
instana-1.204.0.pre3 lib/instana/frameworks/rails.rb
instana-1.204.0.pre2 lib/instana/frameworks/rails.rb
instana-1.204.0.pre1 lib/instana/frameworks/rails.rb
instana-1.203.2 lib/instana/frameworks/rails.rb
instana-1.203.1 lib/instana/frameworks/rails.rb
instana-1.203.0 lib/instana/frameworks/rails.rb
instana-1.202.0 lib/instana/frameworks/rails.rb