Sha256: 13578dc9e1d50672b081868b12a81a2cca7ce4af9ed7d4dbd48a73510fcbed0e

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

module ActionController
  module Instrumentation
    def process_action(*args)
      raw_payload = {
          :controller => self.class.name,
          :action     => self.action_name,
          :params     => request.filtered_parameters,
          :format     => request.format.try(:ref),
          :method     => request.method,
          :path       => (request.fullpath rescue "unknown")
      }

      if Logstasher.payload_appender
        before_keys = raw_payload.keys.clone
        # Execue the payload appened in current context
        self.instance_exec raw_payload, &Logstasher.payload_appender
        after_keys = raw_payload.keys
        # Add to payload all extra keys added to payload hash
        raw_payload[:log_stasher_appended_param_keys] = after_keys - before_keys
      end

      ActiveSupport::Notifications.instrument("start_processing.action_controller", raw_payload.dup)

      ActiveSupport::Notifications.instrument("process_action.action_controller", raw_payload) do |payload|
        result = super
        payload[:status] = response.status
        append_info_to_payload(payload)
        result
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstasher-0.1.1 lib/logstasher/rails_ext/action_controller/metal/instrumentation.rb