Class: Airbrake::Filters::ContextFilter Private
- Inherits:
-
Object
- Object
- Airbrake::Filters::ContextFilter
- Defined in:
- lib/airbrake-ruby/filters/context_filter.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.
Adds user context to the notice object. Clears the context after it’s attached.
Instance Attribute Summary collapse
- #weight ⇒ Integer readonly private
Instance Method Summary collapse
-
#call(notice) ⇒ void
private
This is a mandatory method required by any filter integrated with FilterChain.
-
#initialize ⇒ ContextFilter
constructor
private
A new instance of ContextFilter.
Constructor Details
#initialize ⇒ ContextFilter
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 ContextFilter.
12 13 14 15 |
# File 'lib/airbrake-ruby/filters/context_filter.rb', line 12 def initialize @weight = 119 @mutex = Mutex.new end |
Instance Attribute Details
#weight ⇒ Integer (readonly)
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.
10 11 12 |
# File 'lib/airbrake-ruby/filters/context_filter.rb', line 10 def weight @weight end |
Instance Method Details
#call(notice) ⇒ void
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.
This method returns an undefined value.
This is a mandatory method required by any filter integrated with FilterChain.
18 19 20 21 22 23 24 25 |
# File 'lib/airbrake-ruby/filters/context_filter.rb', line 18 def call(notice) @mutex.synchronize do return if Airbrake::Context.current.empty? notice[:params][:airbrake_context] = Airbrake::Context.current.to_h Airbrake::Context.current.clear end end |