module AppPerfRpm::Instruments::RackModule
Public Instance Methods
call(env)
click to toggle source
# File lib/app_perf_rpm/instruments/rack.rb, line 6 def call(env) req = ::Rack::Request.new(env) #if ::AppPerfRpm::Tracer.in_trace? && # ::AppPerfRpm.config.instrumentation[:rack][:trace_middleware] # AppPerfRpm::Tracer.trace("rack-middleware") do |span| # span.set_tag "type", "web" # span.set_tag "domain", req.host # span.set_tag "url", req.path # span.set_tag "class", @app.class.name # # status, headers, body = @app.call env # end #else span = AppPerfRpm.tracer.start_span("rack") span.set_tag "type", "web" span.set_tag "domain", req.host span.set_tag "url", req.path span.set_tag "class", @app.class.name span.set_tag "backtrace", ::AppPerfRpm::Backtrace.backtrace span.set_tag "source", ::AppPerfRpm::Backtrace.source_extract @app.call(env) rescue Exception => e if span span.set_tag('error', true) span.log_error(e) end raise ensure span.finish if span end