Sha256: 86eaec8333d8110cdb8989cbc0962f76495edb1889f851ed4d7c0424bcfb8b51

Contents?: true

Size: 1007 Bytes

Versions: 9

Compression:

Stored size: 1007 Bytes

Contents

DependencyDetection.defer do
  @name = :active_merchant
  
  depends_on do
    defined?(ActiveMerchant) && defined?(ActiveMerchant::Billing)
  end
  
  executes do
    NewRelic::Agent.logger.debug 'Installing ActiveMerchant instrumentation'
  end
  
  executes do
    ActiveMerchant::Billing::Gateway.implementations.each do |gateway|
      gateway.class_eval do
        implemented_methods = public_instance_methods(false)
        gateway_name = self.name.split('::').last
        [:authorize, :purchase, :credit, :void, :capture, :recurring].each do |operation|
          if implemented_methods.include?(operation.to_s)
            add_method_tracer operation, "ActiveMerchant/gateway/#{gateway_name}/#{operation}", :scoped_metric_only => true
            add_method_tracer operation, "ActiveMerchant/gateway/#{gateway_name}", :push_scope => false
            add_method_tracer operation, "ActiveMerchant/operation/#{operation}", :push_scope => false
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
dolores_rpm-3.2.0.6 lib/new_relic/agent/instrumentation/active_merchant.rb
dolores_rpm-3.2.0.5 lib/new_relic/agent/instrumentation/active_merchant.rb
dolores_rpm-3.2.0.4 lib/new_relic/agent/instrumentation/active_merchant.rb
dolores_rpm-3.2.0.3 lib/new_relic/agent/instrumentation/active_merchant.rb
dolores_rpm-3.2.0.2 lib/new_relic/agent/instrumentation/active_merchant.rb
newrelic_rpm-3.2.0.1 lib/new_relic/agent/instrumentation/active_merchant.rb
newrelic_rpm-3.2.0 lib/new_relic/agent/instrumentation/active_merchant.rb
newrelic_rpm-3.2.0.beta2 lib/new_relic/agent/instrumentation/active_merchant.rb
newrelic_rpm-3.2.0.beta1 lib/new_relic/agent/instrumentation/active_merchant.rb