Module: MetristIpa::NetHttpExtensions

Included in:
Net::HTTP
Defined in:
lib/metrist_ipa.rb

Constant Summary collapse

@@sock =
UDPSocket.new

Instance Method Summary collapse

Instance Method Details

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



18
19
20
21
22
23
24
25
# File 'lib/metrist_ipa.rb', line 18

def request(req, body = nil, &block)
  start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  result = super(req, body, &block)
  delta = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
  delta_ms = delta * 1000
  @@sock.send("0\t#{req.method}\t#{@address}\t#{req.path}\t#{delta_ms}\n", 0, MetristIpa.host, MetristIpa.port)
  result
end