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.8.beta.2 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.8.beta.1 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.8.beta.0 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.7 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.7.beta.1 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.6 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.6.beta.0 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.5 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.4 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.4.beta.0 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.3 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.2 lib/appsignal/rack/instrumentation.rb
appsignal-0.11.1 lib/appsignal/rack/instrumentation.rb