class ScoutApm::ErrorService::ErrorBuffer

Attributes

agent_context[R]

Public Class Methods

new(agent_context) click to toggle source
# File lib/scout_apm/error_service/error_buffer.rb, line 9
def initialize(agent_context)
  @agent_context = agent_context
  @error_records = []
  @mutex = Monitor.new
end

Public Instance Methods

capture(exception, env) click to toggle source
# File lib/scout_apm/error_service/error_buffer.rb, line 15
def capture(exception, env)
  context = ScoutApm::Context.current

  @mutex.synchronize {
    @error_records << ErrorRecord.new(agent_context, exception, env, context)
  }
end
each() { |error_record| ... } click to toggle source

Enables enumerable - for count and each and similar methods

# File lib/scout_apm/error_service/error_buffer.rb, line 32
def each
  @error_records.each do |error_record|
    yield error_record
  end
end
get_and_reset_error_records() click to toggle source
# File lib/scout_apm/error_service/error_buffer.rb, line 23
def get_and_reset_error_records
  @mutex.synchronize {
    ret = @error_records
    @error_records = []
    ret
  }
end