Class: StackifyRubyAPM::Instrumenter Private
- Inherits:
-
Object
- Object
- StackifyRubyAPM::Instrumenter
- Includes:
- Log
- Defined in:
- lib/stackify_apm/instrumenter.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: TransactionInfo
Constant Summary collapse
- KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
:_stackify_transaction_key
Constants included from Log
Instance Attribute Summary collapse
- #agent ⇒ Object readonly private
- #config ⇒ Object readonly private
- #pending_transactions ⇒ Object readonly private
Instance Method Summary collapse
- #current_transaction ⇒ Object private
- #current_transaction=(transaction) ⇒ Object private
-
#initialize(agent) ⇒ Instrumenter
constructor
private
A new instance of Instrumenter.
- #inspect ⇒ Object private
- #span(*args, &block) ⇒ Object private
- #stop ⇒ Object private
-
#submit_transaction(transaction) ⇒ Object
private
Once the transaction is submitted it will be stored temporarily in queue.
- #subscriber=(subscriber) ⇒ Object private
-
#transaction(*args) ⇒ Object
private
Creates a new transaction or return the currently running.
Methods included from Log
#debug, #error, #fatal, #info, #log, #warn
Constructor Details
#initialize(agent) ⇒ Instrumenter
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 Instrumenter.
29 30 31 32 33 34 35 |
# File 'lib/stackify_apm/instrumenter.rb', line 29 def initialize(agent) debug '[Instrumenter] initialize()' if ENV['STACKIFY_TRANSPORT_LOG_LEVEL'] == '0' @agent = agent @config = agent.config @transaction_info = TransactionInfo.new end |
Instance Attribute Details
#agent ⇒ 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.
37 38 39 |
# File 'lib/stackify_apm/instrumenter.rb', line 37 def agent @agent end |
#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.
37 38 39 |
# File 'lib/stackify_apm/instrumenter.rb', line 37 def config @config 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.
37 38 39 |
# File 'lib/stackify_apm/instrumenter.rb', line 37 def pending_transactions @pending_transactions end |
Instance Method Details
#current_transaction ⇒ 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.
49 50 51 |
# File 'lib/stackify_apm/instrumenter.rb', line 49 def current_transaction @transaction_info.current end |
#current_transaction=(transaction) ⇒ 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.
53 54 55 |
# File 'lib/stackify_apm/instrumenter.rb', line 53 def current_transaction=(transaction) @transaction_info.current = transaction end |
#inspect ⇒ 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.
103 104 105 106 107 |
# File 'lib/stackify_apm/instrumenter.rb', line 103 def inspect '<StackifyRubyAPM::Instrumenter ' \ "current_transaction=#{current_transaction.inspect}" \ '>' end |
#span(*args, &block) ⇒ 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.
85 86 87 88 89 90 91 92 93 |
# File 'lib/stackify_apm/instrumenter.rb', line 85 def span(*args, &block) unless current_transaction return yield if block_given? return end current_transaction.span(*args, &block) end |
#stop ⇒ 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.
39 40 41 42 |
# File 'lib/stackify_apm/instrumenter.rb', line 39 def stop current_transaction.release if current_transaction @subscriber.unregister! if @subscriber end |
#submit_transaction(transaction) ⇒ 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.
Once the transaction is submitted it will be stored temporarily in queue
97 98 99 100 101 |
# File 'lib/stackify_apm/instrumenter.rb', line 97 def submit_transaction(transaction) debug '[Instrumenter] submit_transaction(transaction) transaction: ' + transaction.inspect.to_s if ENV['STACKIFY_TRANSPORT_LOG_LEVEL'] == '0' agent.enqueue_transaction transaction return unless config.debug_transactions end |
#subscriber=(subscriber) ⇒ 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.
44 45 46 47 |
# File 'lib/stackify_apm/instrumenter.rb', line 44 def subscriber=(subscriber) @subscriber = subscriber @subscriber.register! end |
#transaction(*args) ⇒ 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.
Creates a new transaction or return the currently running
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/stackify_apm/instrumenter.rb', line 59 def transaction(*args) unless config.instrument yield if block_given? return end if (transaction = current_transaction) yield transaction if block_given? return transaction end transaction = Transaction.new self, *args self.current_transaction = transaction return transaction unless block_given? begin yield transaction ensure self.current_transaction = nil transaction.done end transaction end |