Sha256: 8830ee18ca7e7ab1cf9ec3b20b15af6c3b98ec716ef3196db8ce25ca3235b0b8
Contents?: true
Size: 1011 Bytes
Versions: 1
Compression:
Stored size: 1011 Bytes
Contents
# frozen_string_literal: true begin require "curb" rescue LoadError end module HTTPInstrumentation module Instrumentation # This module is responsible for instrumenting the curb gem. module CurbHook class << self def instrument! Instrumentation.instrument!(::Curl::Easy, self, :http) if defined?(::Curl::Easy) end def installed? !!(defined?(::Curl::Easy) && ::Curl::Easy.include?(self)) end attr_accessor :aliased end def http(method, *args) HTTPInstrumentation.instrument("curb") do |payload| retval = if HTTPInstrumentation::Instrumentation::CurbHook.aliased http_without_http_instrumentation(method, *args) else super end payload[:http_method] = method begin payload[:url] = url payload[:status_code] = response_code rescue end retval end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
http_instrumentation-1.0.1 | lib/http_instrumentation/instrumentation/curb_hook.rb |