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() click to toggle source
# File lib/airbrake-ruby/filters/context_filter.rb, line 12
def initialize
  @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 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