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

Defined in:
lib/datadog/tracing/contrib/ethon/multi_patch.rb

Overview

InstanceMethods - implementing instrumentation

Instance Method Summary collapse

Instance Method Details

#add(easy) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/datadog/tracing/contrib/ethon/multi_patch.rb', line 20

def add(easy)
  handles = super
  return handles unless handles && Tracing.enabled?

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

#performObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/datadog/tracing/contrib/ethon/multi_patch.rb', line 31

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