Module: Datadog::Contrib::Ethon::MultiPatch::InstanceMethods

Defined in:
lib/ddtrace/contrib/ethon/multi_patch.rb

Overview

InstanceMethods - implementing instrumentation

Instance Method Summary collapse

Instance Method Details

#add(easy) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/ddtrace/contrib/ethon/multi_patch.rb', line 18

def add(easy)
  handles = super
  return handles if handles.nil? || !tracer_enabled?

  if datadog_multi_performing?
    # Start Easy span in case Multi is already performing
    easy.datadog_before_request(parent_span: datadog_multi_span)
  end
  handles
end

#performObject



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ddtrace/contrib/ethon/multi_patch.rb', line 29

def perform
  if tracer_enabled?
    easy_handles.each do |easy|
      easy.datadog_before_request(parent_span: datadog_multi_span) unless easy.datadog_span_started?
    end
  end
  super
ensure
  if tracer_enabled? && datadog_multi_performing?
    @datadog_multi_span.finish
    @datadog_multi_span = nil
  end
end