Sha256: 10655fafd3d6f018e937c66352da1771b8994c8bd74afb630492279d3468ae3f

Contents?: true

Size: 1.81 KB

Versions: 43

Compression:

Stored size: 1.81 KB

Contents

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

if defined?(ActionView::Base) && Oboe::Config[:action_view][:enabled]

  ##
  # ActionView Instrumentation is version dependent.  ActionView 2.x is separate
  # and ActionView 3.0 is a special case.
  # Everything else goes here. (ActionView 3.1 - 4.0 as of this writing)
  #
  if (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR > 0) || Rails::VERSION::MAJOR == 4

    Oboe.logger.info '[oboe/loading] Instrumenting actionview' if Oboe::Config[:verbose]

    ActionView::PartialRenderer.class_eval do
      alias :render_partial_without_oboe :render_partial
      def render_partial
        entry_kvs = {}
        begin
          name = Oboe::Util.prettify(@options[:partial]) if @options.is_a?(Hash)
          entry_kvs[:FunctionName] = :render_partial
          entry_kvs[:Class]        = :PartialRenderer
          entry_kvs[:Module]       = :ActionView
          entry_kvs[:File]         = __FILE__
          entry_kvs[:LineNumber]   = __LINE__
        rescue
        end

        Oboe::API.profile(name, entry_kvs, Oboe::Config[:action_view][:collect_backtraces]) do
          render_partial_without_oboe
        end
      end

      alias :render_collection_without_oboe :render_collection
      def render_collection
        entry_kvs = {}
        begin
          name = Oboe::Util.prettify(@path)
          entry_kvs[:FunctionName] = :render_collection
          entry_kvs[:Class]        = :PartialRenderer
          entry_kvs[:Module]       = :ActionView
          entry_kvs[:File]         = __FILE__
          entry_kvs[:LineNumber]   = __LINE__
        rescue
        end

        Oboe::API.profile(name, entry_kvs, Oboe::Config[:action_view][:collect_backtraces]) do
          render_collection_without_oboe
        end
      end

    end
  end
end

# vim:set expandtab:tabstop=2

Version data entries

43 entries across 43 versions & 1 rubygems

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