Sha256: 9ae13ec7d2ed8446635185806b7e67b91fb5c406fe5c00ee5a68ddcc4d1a3691
Contents?: true
Size: 802 Bytes
Versions: 2
Compression:
Stored size: 802 Bytes
Contents
require 'speed_gun/hook' SpeedGun.hook('Net::HTTP') do depends do defined?(Net) && defined?(Net::HTTP) end execute do require 'speed_gun/profiler/http_profiler' class Net::HTTP def request_with_speedgun(req, *args, &block) payload = { request: { method: req.method, uri: req.uri.to_s, headers: req.to_hash } } SpeedGun::Profiler::HTTPProfiler.profile('http.' + req.method.downcase, payload) do |event| res = request_without_speedgun(req, *args, &block) event.payload[:response] = { version: res.http_version, code: res.code, headers: res.to_hash } res end end alias request_without_speedgun request alias request request_with_speedgun end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
speed_gun-2.0.1 | lib/speed_gun/hook/net/http.rb |
speed_gun-2.0.0 | lib/speed_gun/hook/net/http.rb |