13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/dontbugme/subscribers/net_http.rb', line 13
def request(req, body = nil, &block)
return super unless Dontbugme::Context.active?
return super unless Dontbugme.config.recording?
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
start_wall = Time.now
response = super
duration_ms = (Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond) - start_time).round(2)
record_span(req, response, start_wall, duration_ms)
response
rescue StandardError => e
duration_ms = (Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond) - start_time).round(2)
record_span(req, nil, start_wall, duration_ms, error: e)
raise
end
|