Module: Bugwatch::HttpTracker::NetHttpPatch

Defined in:
lib/bugwatch/http_tracker.rb

Instance Method Summary collapse

Instance Method Details

#request(req, body = nil, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bugwatch/http_tracker.rb', line 10

def request(req, body = nil, &block)
  return super if Thread.current[:bugwatch_skip_tracking]
  return super unless HttpTracker.collecting?

  start    = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  response = super
  duration_ms = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) * 1000).round(2)

  HttpTracker.handle_call(self, req, response, duration_ms)
  response
rescue Exception # rubocop:disable Lint/RescueException
  raise
end