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
34
35
|
# File 'lib/baseline_red_rpm/instruments/roda.rb', line 6
def call_with_trace(&block)
if BaselineRedRpm::Tracer.tracing?
req = ::Rack::Request.new(env)
request_method = req.request_method.to_s.upcase
path = req.path
parts = path.to_s.rpartition("/")
action = parts.last
controller = parts.first.sub(/\A\//, '').split("/").collect {|w| w.capitalize }.join("::")
operation = "#{controller}##{action}"
span = BaselineRedRpm.tracer.start_span(operation, tags: {
"component" => "Roda",
"http.url" => path,
"http.method" => request_method,
"params" => @_request.params
})
BaselineRedRpm::Utils.log_source_and_backtrace(span, :roda)
end
call_without_trace(&block)
rescue Exception => e
if span
span.set_tag('error', true)
span.log_error(e)
end
raise
ensure
span.finish if span
end
|