Sha256: 8cbd30d0d7b540833878d182070c31e497dbde56038250a0692af107beaf8241

Contents?: true

Size: 1.9 KB

Versions: 43

Compression:

Stored size: 1.9 KB

Contents

# Copyright (c) 2014 AppNeta, Inc.
# All rights reserved.

module Oboe
  module PadrinoInst
    module Routing
      def self.included(klass)
        ::Oboe::Util.method_alias(klass, :dispatch!, ::Padrino::Routing)
      end

      def dispatch_with_oboe
        if Oboe.tracing?
          report_kvs = {}

          # Fall back to the raw tracing API so we can pass KVs
          # back on exit (a limitation of the Oboe::API.trace
          # block method) This removes the need for an info
          # event to send additonal KVs
          ::Oboe::API.log_entry('padrino', {})

          begin
            r = dispatch_without_oboe

            # Report Controller/Action as best possible
            if request.controller and not request.controller.empty?
              report_kvs[:Controller] = request.controller
            else
              report_kvs[:Controller] = self.class
            end

            report_kvs[:Action] = request.action
            r
           ensure
            ::Oboe::API.log_exit('padrino', report_kvs)
           end
        else
          dispatch_without_oboe
        end
      end
    end
  end
end

if defined?(::Padrino)
  # This instrumentation is a superset of the Sinatra instrumentation similar
  # to how Padrino is a superset of Sinatra itself.
  ::Oboe.logger.info "[oboe/loading] Instrumenting Padrino" if Oboe::Config[:verbose]

  require 'oboe/frameworks/padrino/templates'

  Padrino.after_load do
    ::Oboe.logger = ::Padrino.logger if ::Padrino.respond_to?(:logger)
    ::Oboe::Loading.load_access_key
    ::Oboe::Inst.load_instrumentation

    ::Oboe::Util.send_include(::Padrino::Routing::InstanceMethods, ::Oboe::PadrinoInst::Routing)
    if defined?(::Padrino::Rendering)
      ::Oboe::Util.send_include(::Padrino::Rendering::InstanceMethods, ::Oboe::PadrinoInst::Rendering)
    end

    # Report __Init after fork when in Heroku
    Oboe::API.report_init unless Oboe.heroku?
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
oboe-2.7.19-java lib/oboe/frameworks/padrino.rb
oboe-2.7.19 lib/oboe/frameworks/padrino.rb
oboe-2.7.18-java lib/oboe/frameworks/padrino.rb
oboe-2.7.18 lib/oboe/frameworks/padrino.rb
oboe-2.7.17.1-java lib/oboe/frameworks/padrino.rb
oboe-2.7.17.1 lib/oboe/frameworks/padrino.rb
oboe-2.7.16.1 lib/oboe/frameworks/padrino.rb
oboe-2.7.16.1-java lib/oboe/frameworks/padrino.rb
oboe-2.7.15.1-java lib/oboe/frameworks/padrino.rb
oboe-2.7.15.1 lib/oboe/frameworks/padrino.rb
oboe-2.7.14.1-java lib/oboe/frameworks/padrino.rb
oboe-2.7.14.1 lib/oboe/frameworks/padrino.rb
oboe-2.7.13.3-java lib/oboe/frameworks/padrino.rb
oboe-2.7.13.3 lib/oboe/frameworks/padrino.rb
oboe-2.7.12.1-java lib/oboe/frameworks/padrino.rb
oboe-2.7.12.1 lib/oboe/frameworks/padrino.rb
oboe-2.7.11.1 lib/oboe/frameworks/padrino.rb
oboe-2.7.11.1-java lib/oboe/frameworks/padrino.rb
oboe-2.7.10.1-java lib/oboe/frameworks/padrino.rb
oboe-2.7.10.1 lib/oboe/frameworks/padrino.rb