lib/opentelemetry/instrumentation/sinatra/middlewares/tracer_middleware.rb in opentelemetry-instrumentation-sinatra-0.21.3 vs lib/opentelemetry/instrumentation/sinatra/middlewares/tracer_middleware.rb in opentelemetry-instrumentation-sinatra-0.21.4
- old
+ new
@@ -14,26 +14,20 @@
def initialize(app)
@app = app
end
def call(env)
- response = @app.call(env)
+ @app.call(env)
ensure
- trace_response(env, response)
+ trace_response(env)
end
- def trace_response(env, response)
+ def trace_response(env)
span = OpenTelemetry::Instrumentation::Rack.current_span
return unless span.recording?
span.set_attribute('http.route', env['sinatra.route'].split.last) if env['sinatra.route']
span.name = env['sinatra.route'] if env['sinatra.route']
-
- sinatra_response = ::Sinatra::Response.new([], response.first)
- return unless sinatra_response.server_error?
-
- span.record_exception(env['sinatra.error']) if env['sinatra.error']
- span.status = OpenTelemetry::Trace::Status.error
end
end
end
end
end