Class: PlainApm::Extensions::Context::Rack
- Inherits:
-
Object
- Object
- PlainApm::Extensions::Context::Rack
- Defined in:
- lib/plain_apm/extensions/context/rack.rb,
lib/plain_apm/extensions/context/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Rack
constructor
A new instance of Rack.
Constructor Details
#initialize(app) ⇒ Rack
Returns a new instance of Rack.
15 16 17 |
# File 'lib/plain_apm/extensions/context/rack.rb', line 15 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/plain_apm/extensions/context/rack.rb', line 19 def call(env) Context.trace_id = trace_id(env) status, headers, body = @app.call(env) body = if defined?(::Rack::BodyProxy) ::Rack::BodyProxy.new(body) do Context.clear! end else body end processed = true [status, headers, body] ensure Context.clear! if !processed end |