Class: StackifyRubyAPM::Worker Private
- Inherits:
-
Object
- Object
- StackifyRubyAPM::Worker
- Includes:
- Log
- Defined in:
- lib/stackify_apm/worker.rb
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.
Defined Under Namespace
Classes: ErrorMsg, FlushMsg, StopMsg
Constant Summary
Constants included from Log
Instance Attribute Summary collapse
- #config ⇒ Object readonly private
- #messages ⇒ Object readonly private
- #pending_transactions ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(config, messages, pending_transactions, trace_logger) ⇒ Worker
constructor
private
A new instance of Worker.
-
#run_forever ⇒ Object
private
Collects and sends the transactions.
Methods included from Log
#debug, #error, #fatal, #info, #log, #warn
Constructor Details
#initialize(config, messages, pending_transactions, trace_logger) ⇒ Worker
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 Worker.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/stackify_apm/worker.rb', line 29 def initialize(config, , pending_transactions, trace_logger) @config = config @messages = @pending_transactions = pending_transactions @trace_logger = trace_logger @serializers = Struct.new(:transactions, :errors).new( Serializers::Transactions.new(config), Serializers::Errors.new(config) ) end |
Instance Attribute Details
#config ⇒ Object (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.
41 42 43 |
# File 'lib/stackify_apm/worker.rb', line 41 def config @config end |
#messages ⇒ Object (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.
41 42 43 |
# File 'lib/stackify_apm/worker.rb', line 41 def @messages end |
#pending_transactions ⇒ Object (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.
41 42 43 |
# File 'lib/stackify_apm/worker.rb', line 41 def pending_transactions @pending_transactions end |
Instance Method Details
#run_forever ⇒ Object
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.
Collects and sends the transactions
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/stackify_apm/worker.rb', line 45 def run_forever @timer_task = build_timer_task.execute while (msg = .pop) case msg when ErrorMsg post_error msg when FlushMsg collect_and_send_transactions when StopMsg # empty collected transactions before exiting collect_and_send_transactions stop! end end end |