Sha256: 02980184e94c68fd26ab605af0360e462e391fc90170ac6cf93d711f6c6b0c15

Contents?: true

Size: 827 Bytes

Versions: 33

Compression:

Stored size: 827 Bytes

Contents

module Appsignal
  module Rack
    class Instrumentation
      def initialize(app, options = {})
        Appsignal.logger.debug 'Initializing Appsignal::Rack::Instrumentation'
        @app, @options = app, options
      end

      def call(env)
        ActiveSupport::Notifications.instrument(
          'process_action.rack',
          raw_payload(env)
        ) do |payload|
          @app.call(env)
        end
      end

      def raw_payload(env)
        request = @options.fetch(:request_class, ::Rack::Request).new(env)
        params = request.public_send(@options.fetch(:params_method, :params))
        {
          :action => "#{request.request_method}:#{request.path}",
          :params => params,
          :method => request.request_method,
          :path   => request.path
        }
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
appsignal-0.11.18 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.17 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.16 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.15 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.14 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.14.beta.1 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.13 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.13.beta.4 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.13.beta.3 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.13.beta.2 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.13.beta.1 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.13.beta.0 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.12 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.11 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.10 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.10.beta.2 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.10.beta.1 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.9 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.8.beta.4 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.8.beta.3 lib/appsignal/rack/instrumentation.rb