Class: Airbrake::Rack::ContextFilter
- Inherits:
-
Object
- Object
- Airbrake::Rack::ContextFilter
- Defined in:
- lib/airbrake/rack/context_filter.rb
Overview
Adds context (URL, User-Agent, framework version, controller and more).
Instance Attribute Summary collapse
- #weight ⇒ Integer readonly
Instance Method Summary collapse
- #call(notice) ⇒ Object
-
#initialize ⇒ ContextFilter
constructor
A new instance of ContextFilter.
Constructor Details
#initialize ⇒ ContextFilter
Returns a new instance of ContextFilter.
12 13 14 |
# File 'lib/airbrake/rack/context_filter.rb', line 12 def initialize @weight = 99 end |
Instance Attribute Details
#weight ⇒ Integer (readonly)
10 11 12 |
# File 'lib/airbrake/rack/context_filter.rb', line 10 def weight @weight end |
Instance Method Details
#call(notice) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/airbrake/rack/context_filter.rb', line 17 def call(notice) return unless (request = notice.stash[:rack_request]) context = notice[:context] context[:url] = request.url context[:userAgent] = request.user_agent add_ip(context, request) add_framework_version(context) controller = request.env['action_controller.instance'] return unless controller context[:component] = controller.controller_name context[:action] = controller.action_name end |