Skip to content

Instantly share code, notes, and snippets.

View romatr's full-sized avatar
👻
Es geht mir gut

Roman Trofimov romatr

👻
Es geht mir gut
  • Berlin, Germany
View GitHub Profile
@romatr
romatr / instrumenter.rb
Created April 4, 2014 12:37
Exception backtrace
ActiveSupport::Notifications::Instrumenter.class_eval do
def instrument(name, payload = {})
start name, payload
begin
yield payload
rescue Exception => e
payload[:exception] = [e.class.name, e.message, e.backtrace]
raise e
ensure
finish name, payload
@romatr
romatr / instrumentation.rb
Created April 4, 2014 12:31
Request and session object to be available in Rail notifications payload
ActionController::Instrumentation.class_eval do
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"),
request: request,