Sha256: 287872333efdc575b8332a5f2c89e0f772e076b6361ff38efdd1de5af5292341

Contents?: true

Size: 976 Bytes

Versions: 3

Compression:

Stored size: 976 Bytes

Contents

# encoding: utf-8

require 'one_apm/inst/framework/sinatra'

LibraryDetection.defer do
  @name = :padrino

  depends_on do
    !OneApm::Agent.config[:disable_sinatra] &&
      defined?(::Padrino) && defined?(::Padrino::Routing::InstanceMethods)
  end

  executes do
    ::OneApm::Agent.logger.info 'Installing Padrino instrumentation'

    # Our Padrino instrumentation relies heavily on the fact that Padrino is
    # built on Sinatra. Although it wires up a lot of its own routing logic,
    # we only need to patch into Padrino's dispatch to get things started.
    #
    # Parts of the Sinatra instrumentation (such as the TransactionNamer) are
    # aware of Padrino as a potential target in areas where both Sinatra and
    # Padrino run through the same code.
    module ::Padrino::Routing::InstanceMethods
      include OneApm::Agent::Instrumentation::Sinatra

      alias dispatch_without_oneapm dispatch!
      alias dispatch! dispatch_with_oneapm
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oneapm_rpm-1.1.2 lib/one_apm/inst/framework/padrino.rb
oneapm_rpm-1.1.1 lib/one_apm/inst/framework/padrino.rb
oneapm_rpm-1.1.0 lib/one_apm/inst/framework/padrino.rb