Class: AppMap::Trace::EventHandler::RackHandlerWebrick::Call

Inherits:
MethodEvent show all
Defined in:
lib/appmap/trace/event_handler/rack_handler_webrick.rb

Constant Summary

Constants inherited from MethodEvent

MethodEvent::COUNTER_LOCK, MethodEvent::LIMIT

Instance Attribute Summary collapse

Attributes inherited from MethodEventStruct

#defined_class, #event, #id, #lineno, #method_id, #path, #static, #thread_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MethodEvent

display_string, next_id, value_in_binding

Instance Attribute Details

#http_server_requestObject

Returns the value of attribute http_server_request.



10
11
12
# File 'lib/appmap/trace/event_handler/rack_handler_webrick.rb', line 10

def http_server_request
  @http_server_request
end

Class Method Details

.build_from_tracepoint(mc = Call.new, tp, path) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/appmap/trace/event_handler/rack_handler_webrick.rb', line 13

def build_from_tracepoint(mc = Call.new, tp, path)
  mc.tap do |_|
    req = value_in_binding(tp, :req)

    # Don't try and grab 'parameters', because:
    # a) They aren't needed.
    # b) We want to avoid triggering side effects like reading the request body.

    mc.http_server_request = {
      request_method: req.request_method,
      path_info: req.path_info,
      protocol: "HTTP/#{req.http_version}"
    }

    MethodEvent.build_from_tracepoint(mc, tp, path)
  end
end

Instance Method Details

#to_hObject



32
33
34
35
36
# File 'lib/appmap/trace/event_handler/rack_handler_webrick.rb', line 32

def to_h
  super.tap do |h|
    h[:http_server_request] = http_server_request
  end
end