Class: AppMap::Handler::Rails::RequestHandler::HTTPServerRequest
- Inherits:
-
Event::MethodEvent
- Object
- Struct
- Event::MethodEventStruct
- Event::MethodEvent
- AppMap::Handler::Rails::RequestHandler::HTTPServerRequest
- Defined in:
- lib/appmap/handler/rails/request_handler.rb
Constant Summary
Constants inherited from Event::MethodEvent
Event::MethodEvent::MAX_ARRAY_ENUMERATION, Event::MethodEvent::MAX_HASH_ENUMERATION, Event::MethodEvent::MAX_STRING_LENGTH
Constants included from ValueInspector
ValueInspector::MAX_ARRAY_ELEMENTS, ValueInspector::MAX_DEPTH
Instance Attribute Summary collapse
-
#call_elapsed_instrumentation ⇒ Object
Returns the value of attribute call_elapsed_instrumentation.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#normalized_path_info ⇒ Object
Returns the value of attribute normalized_path_info.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path_info ⇒ Object
Returns the value of attribute path_info.
-
#request_method ⇒ Object
Returns the value of attribute request_method.
Attributes inherited from Event::MethodEventStruct
Instance Method Summary collapse
-
#initialize(request) ⇒ HTTPServerRequest
constructor
A new instance of HTTPServerRequest.
- #to_h ⇒ Object
Methods inherited from Event::MethodEvent
add_schema, add_size, build_from_invocation, custom_display_string, default_display_string, display_string, encode_display_string, #ready?
Methods included from ValueInspector
#best_class_name, #detect_schema, #detect_size
Constructor Details
#initialize(request) ⇒ HTTPServerRequest
Returns a new instance of HTTPServerRequest.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/appmap/handler/rails/request_handler.rb', line 16 def initialize(request) super AppMap::Event.next_id_counter, :call, Thread.current.object_id self.request_method = request.request_method self.normalized_path_info = normalized_path(request) self.headers = AppMap::Util.select_rack_headers(request.env) self.path_info = request.path_info.split("?")[0] # ActionDispatch::Http::ParameterFilter is deprecated parameter_filter_cls = \ if defined?(ActiveSupport::ParameterFilter) ActiveSupport::ParameterFilter else ActionDispatch::Http::ParameterFilter end self.params = parameter_filter_cls.new(::Rails.application.config.filter_parameters).filter(request.params) end |
Instance Attribute Details
#call_elapsed_instrumentation ⇒ Object
Returns the value of attribute call_elapsed_instrumentation.
14 15 16 |
# File 'lib/appmap/handler/rails/request_handler.rb', line 14 def call_elapsed_instrumentation @call_elapsed_instrumentation end |
#headers ⇒ Object
Returns the value of attribute headers.
14 15 16 |
# File 'lib/appmap/handler/rails/request_handler.rb', line 14 def headers @headers end |
#normalized_path_info ⇒ Object
Returns the value of attribute normalized_path_info.
14 15 16 |
# File 'lib/appmap/handler/rails/request_handler.rb', line 14 def normalized_path_info @normalized_path_info end |
#params ⇒ Object
Returns the value of attribute params.
14 15 16 |
# File 'lib/appmap/handler/rails/request_handler.rb', line 14 def params @params end |
#path_info ⇒ Object
Returns the value of attribute path_info.
14 15 16 |
# File 'lib/appmap/handler/rails/request_handler.rb', line 14 def path_info @path_info end |
#request_method ⇒ Object
Returns the value of attribute request_method.
14 15 16 |
# File 'lib/appmap/handler/rails/request_handler.rb', line 14 def request_method @request_method end |
Instance Method Details
#to_h ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/appmap/handler/rails/request_handler.rb', line 33 def to_h super.tap do |h| h[:http_server_request] = { request_method: request_method, path_info: path_info, normalized_path_info: normalized_path_info, headers: headers }.compact unless Util.blank?(params) h[:message] = params.keys.map do |key| val = params[key] { name: key, class: val.class.name, value: self.class.display_string(val), object_id: val.__id__ }.tap do || AppMap::Event::MethodEvent.add_schema , val end end end end end |