Sha256: 6cab9bef2989437a4e198ccf91a1cb1f5f1a05e503497c83d95eb8a188c30262

Contents?: true

Size: 922 Bytes

Versions: 5

Compression:

Stored size: 922 Bytes

Contents

# frozen_string_literal: true

##
# This code is inspired by request_store gem by Steve Klabnik:
#
# https://github.com/steveklabnik/request_store/
#
# See LICENSE.txt in the current directory for the license.

module PlainApm
  module Extensions
    module Context
      class Railtie < Rails::Railtie
        initializer(:plain_apm_thread_context, after: :plain_apm_agent_start) do |app|
          next if !PlainApm.agent.enabled?

          ActiveSupport.on_load(:active_job, run_once: true) do |klass|
            klass.prepend(PlainApm::Extensions::Context::ActiveJob)
          end

          if defined?(ActionDispatch::RequestId)
            app.config.middleware.insert_after ActionDispatch::RequestId, PlainApm::Extensions::Context::Rack
          else
            app.config.middleware.insert_after Rack::MethodOverride, PlainApm::Extensions::Context::Rack
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
plain_apm-0.9.7 lib/plain_apm/extensions/context/railtie.rb
plain_apm-0.9.6 lib/plain_apm/extensions/context/railtie.rb
plain_apm-0.9.5 lib/plain_apm/extensions/context/railtie.rb
plain_apm-0.9.4 lib/plain_apm/extensions/context/railtie.rb
plain_apm-0.9.3 lib/plain_apm/extensions/context/railtie.rb