Class: Rack::DevInsight::RequestRecorder
- Inherits:
-
BaseRecorder
- Object
- BaseRecorder
- Rack::DevInsight::RequestRecorder
- Defined in:
- lib/rack/dev_insight/recorder/request_recorder.rb
Instance Method Summary collapse
Instance Method Details
#record(http_method:, path:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rack/dev_insight/recorder/request_recorder.rb', line 8 def record(http_method:, path:) return yield if Context.current.nil? start = Process.clock_gettime(Process::CLOCK_MONOTONIC) status, headers, body = yield duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start Context.current.result.set_request( status: status, http_method: http_method, path: path, duration: format('%.2f', duration * 1000).to_f, ) [status, headers, body] end |