Class: Signalman::ActionHandler

Inherits:
BaseHandler show all
Defined in:
lib/signalman.rb

Instance Attribute Summary

Attributes inherited from BaseHandler

#current_time, #event

Instance Method Summary collapse

Methods inherited from BaseHandler

call, #create_event, #finished_at, #initialize, #start, #started_at

Constructor Details

This class inherits a constructor from Signalman::BaseHandler

Instance Method Details

#processObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/signalman.rb', line 55

def process
  headers = {}
  event.payload.fetch(:headers, {}).each do |name, value|
    headers[name] = value if name.start_with?("HTTP")
    headers[name] = value if ActionDispatch::Http::Headers::CGI_VARIABLES.include?(name)

    [
      "action_dispatch.request_id"
    ].each do |header_name|
      headers[name] = value if name == header_name
    end
  end

  create_event event.payload.slice(
      :method,
      :path,
      :controller,
      :action,
      :params,
      :format,
      :status,
      :db_runtime,
      :view_runtime
    ).merge(headers: headers)
end

#skip?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/signalman.rb', line 81

def skip?
  event.payload[:controller].start_with?("Signalman::")
end