6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/app_perf_rpm/instruments/typhoeus.rb', line 6
def run_with_trace
if ::AppPerfRpm::Tracer.tracing?
span = ::AppPerfRpm.tracer.start_span("typhoeus", tags: {
"component" => "Typhoeus"
})
AppPerfRpm.tracer.inject(span.context, OpenTracing::FORMAT_RACK, options[:headers])
response = run_without_trace
span.exit
uri = URI(response.effective_url)
span.set_tag "http.status_code", response.code
span.set_tag "http.url", uri.to_s
span.set_tag "http.method", options[:method]
AppPerfRpm::Utils.log_source_and_backtrace(span, :typhoeus)
else
response = run_without_trace
end
response
rescue Exception => e
if span
span.set_tag('error', true)
span.log_error(e)
end
raise
ensure
span.finish if span
end
|