Class: ScoutApm::ErrorService::ErrorBuffer
- Inherits:
-
Object
- Object
- ScoutApm::ErrorService::ErrorBuffer
- Includes:
- Enumerable
- Defined in:
- lib/scout_apm/error_service/error_buffer.rb
Instance Attribute Summary collapse
-
#agent_context ⇒ Object
readonly
Returns the value of attribute agent_context.
Instance Method Summary collapse
- #capture(exception, env) ⇒ Object
-
#each ⇒ Object
Enables enumerable - for count and each and similar methods.
- #get_and_reset_error_records ⇒ Object
-
#initialize(agent_context) ⇒ ErrorBuffer
constructor
A new instance of ErrorBuffer.
Constructor Details
#initialize(agent_context) ⇒ ErrorBuffer
Returns a new instance of ErrorBuffer.
9 10 11 12 13 |
# 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 |
Instance Attribute Details
#agent_context ⇒ Object (readonly)
Returns the value of attribute agent_context.
7 8 9 |
# File 'lib/scout_apm/error_service/error_buffer.rb', line 7 def agent_context @agent_context end |
Instance Method Details
#capture(exception, env) ⇒ Object
15 16 17 18 19 20 21 |
# 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 ⇒ Object
Enables enumerable - for count and each and similar methods
32 33 34 35 36 |
# 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 ⇒ Object
23 24 25 26 27 28 29 |
# 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 |