Module: Datadog::Contrib::HTTP::Instrumentation

Defined in:
lib/ddtrace/contrib/http/instrumentation.rb

Overview

Instrumentation for Net::HTTP

Defined Under Namespace

Modules: InstanceMethods, InstanceMethodsCompatibility

Class Method Summary collapse

Class Method Details

.after_request(&block) ⇒ Object

Span hook invoked after request is completed.



27
28
29
30
31
32
33
34
35
# File 'lib/ddtrace/contrib/http/instrumentation.rb', line 27

def self.after_request(&block)
  if block_given?
    # Set hook
    @after_request = block
  else
    # Get hook
    @after_request ||= nil
  end
end

.included(base) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ddtrace/contrib/http/instrumentation.rb', line 14

def self.included(base)
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0')
    base.class_eval do
      # Instance methods
      include InstanceMethodsCompatibility
      include InstanceMethods
    end
  else
    base.send(:prepend, InstanceMethods)
  end
end