Class: Honeybadger::Rack::RequestId Private
- Inherits:
-
Object
- Object
- Honeybadger::Rack::RequestId
- Defined in:
- lib/honeybadger/rack/request_id.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Copies the request ID assigned by ActionDispatch::RequestId into the Honeybadger context. Must sit after ActionDispatch::RequestId in the middleware stack.
No ensure/cleanup here: ErrorNotifier owns the request lifecycle and clears state after the stack unwinds. Clearing here would nil the ID before ErrorNotifier builds the notice on exception.
Instance Method Summary collapse
- #call(env) ⇒ Object private
-
#initialize(app, agent = nil) ⇒ RequestId
constructor
private
A new instance of RequestId.
Constructor Details
#initialize(app, agent = nil) ⇒ RequestId
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RequestId.
15 16 17 18 |
# File 'lib/honeybadger/rack/request_id.rb', line 15 def initialize(app, agent = nil) @app = app @agent = agent if agent.is_a?(Agent) end |
Instance Method Details
#call(env) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 24 |
# File 'lib/honeybadger/rack/request_id.rb', line 20 def call(env) request_id = env["action_dispatch.request_id"] (@agent || Honeybadger::Agent.instance).set_request_id(request_id) if request_id @app.call(env) end |