Module: Watchforge::Tracing

Defined in:
lib/watchforge/tracing.rb

Class Method Summary collapse

Class Method Details

.current_transactionObject



106
107
108
# File 'lib/watchforge/tracing.rb', line 106

def current_transaction
  @stack.last
end

.finish_transaction(status = "ok") ⇒ Object



110
111
112
113
# File 'lib/watchforge/tracing.rb', line 110

def finish_transaction(status = "ok")
  txn = @stack.pop
  txn&.finish(status)
end

.start_transaction(transaction, transaction_name = nil, op = "http.server") ⇒ Object



97
98
99
100
101
102
103
104
# File 'lib/watchforge/tracing.rb', line 97

def start_transaction(transaction, transaction_name = nil, op = "http.server")
  client = Watchforge.client
  return nil unless client

  txn = Transaction.new(client, transaction, transaction_name, op)
  @stack << txn
  txn
end