class Airbrake::Filters::ContextFilter

Adds user context to the notice object. Clears the context after it's attached.

@api private @since v2.9.0

Attributes

weight[R]

@return [Integer]

Public Class Methods

new(context) click to toggle source
# File lib/airbrake-ruby/filters/context_filter.rb, line 12
def initialize(context)
  @context = context
  @weight = 119
  @mutex = Mutex.new
end

Public Instance Methods

call(notice) click to toggle source

@macro call_filter

# File lib/airbrake-ruby/filters/context_filter.rb, line 19
def call(notice)
  @mutex.synchronize do
    return if @context.empty?

    notice[:params][:airbrake_context] = @context.dup
    @context.clear
  end
end