class AppDynamics::BusinessTransactions::TransactionSet

Public Class Methods

new() click to toggle source
# File lib/app_dynamics/business_transactions.rb, line 220
def initialize
  @auto_transaction = AutoTransaction.new
  @named_transactions = {}
end

Public Instance Methods

add_named_matcher(name, paths, methods=[]) click to toggle source
# File lib/app_dynamics/business_transactions.rb, line 249
def add_named_matcher(name, paths, methods=[])
  # FIXME: Check name type
  # FIXME: Check paths type
  # FIXME: Check methods type

  unless @named_transactions.has_key?(name)
    # FIXME: Check if we've exceeded limit
    @named_transactions[name] = NamedTransaction.new(name, [])
  end

  transaction = @named_transactions[name]

  paths = [paths] unless paths.is_a?(Array)

  unless methods.nil?
    methods = [methods] unless methods.is_a?(Array)
    methods.map!{|m| METHODS.fetch(m) }
  end

  # FIXME: Check data type
  transaction.add_matcher(PathAndMethodMatcher.new(paths, methods))
end
all_transactions() click to toggle source
# File lib/app_dynamics/business_transactions.rb, line 230
def all_transactions
  transactions = @named_transactions.values
  transactions << @auto_transaction if @auto_transaction
  transactions
end
define(&block) click to toggle source
# File lib/app_dynamics/business_transactions.rb, line 225
def define(&block)
  definition = Definition.new(self)
  definition.instance_exec(&block)
end
match(env) click to toggle source
# File lib/app_dynamics/business_transactions.rb, line 236
def match(env)
  bt = all_transactions.find{|t| t.matches?(env) }
  bt ? bt.name_for(env) : nil
end
update_auto(enabled=true, **options) click to toggle source
# File lib/app_dynamics/business_transactions.rb, line 241
def update_auto(enabled=true, **options)
  if enabled
    @auto_transaction = AutoTransaction.new(**options)
  else
    @auto_transaction = nil
  end
end