Sha256: f04ba25ff99bd2512a787619c3d6faa60b3319c48a40d42337f281f65565805b

Contents?: true

Size: 1.21 KB

Versions: 39

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8

LibraryDetection.defer do
  @name = :active_merchant

  depends_on do
    defined?(ActiveMerchant) && defined?(ActiveMerchant::Billing) &&
      defined?(ActiveMerchant::Billing::Gateway) &&
      ActiveMerchant::Billing::Gateway.respond_to?(:implementations)
  end

  executes do
    OneApm::Manager.logger.info 'Installing ActiveMerchant instrumentation'
  end

  executes do
    class ActiveMerchant::Billing::Gateway
      include OneApm::Support::MethodTracer
    end

    ActiveMerchant::Billing::Gateway.implementations.each do |gateway|
      gateway.class_eval do
        implemented_methods = public_instance_methods(false).map(&:to_sym)
        gateway_name = self.name.split('::').last
        [:authorize, :purchase, :credit, :void, :capture, :recurring, :store, :unstore, :update].each do |operation|
          if implemented_methods.include?(operation)
            add_method_tracer operation, "ActiveMerchant/gateway/#{gateway_name}/#{operation}"
            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

39 entries across 39 versions & 1 rubygems

Version Path
oneapm_rpm-1.4.2 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.4.1 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.4.0 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.7 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.7.rc1 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.6 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.6.rc1 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.5 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.5.rc1 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.4 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.4.rc1 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.3 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.3.rc1 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.2 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.2.rc1 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.1 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.1.rc1 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.0 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.3.0.rc1 lib/one_apm/inst/3rd/active_merchant.rb
oneapm_rpm-1.2.9 lib/one_apm/inst/3rd/active_merchant.rb