lib/logstasher/rails_ext/action_controller/metal/instrumentation.rb in logstasher-0.1.1 vs lib/logstasher/rails_ext/action_controller/metal/instrumentation.rb in logstasher-0.2.0
- old
+ new
@@ -8,16 +8,16 @@
:format => request.format.try(:ref),
:method => request.method,
:path => (request.fullpath rescue "unknown")
}
- if Logstasher.payload_appender
+ LogStasher.add_default_fields_to_payload(raw_payload, request)
+ if self.respond_to?(:logtasher_add_custom_fields_to_payload)
before_keys = raw_payload.keys.clone
- # Execue the payload appened in current context
- self.instance_exec raw_payload, &Logstasher.payload_appender
+ logtasher_add_custom_fields_to_payload(raw_payload)
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
+ # Store all extra keys added to payload hash in payload itself. This is a thread safe way
+ LogStasher.custom_fields += 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|
\ No newline at end of file