Sha256: 9c6b3df72620feb957749d02589665f16ea51eb43d6373f73c00bb2f2290e123

Contents?: true

Size: 1.84 KB

Versions: 22

Compression:

Stored size: 1.84 KB

Contents

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

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

  if Rails::VERSION::MAJOR == 2

    TraceView.logger.info '[traceview/loading] Instrumenting actionview' if TraceView::Config[:verbose]

    ActionView::Partials.module_eval do
      alias :render_partial_without_traceview :render_partial
      def render_partial(options = {})
        if options.key?(:partial) && options[:partial].is_a?(String)
          entry_kvs = {}
          begin
            name  = TraceView::Util.prettify(options[:partial]) if options.is_a?(Hash)
            entry_kvs[:FunctionName] = :render_partial
            entry_kvs[:Class]        = :Partials
            entry_kvs[:Module]       = :ActionView
            entry_kvs[:File]         = __FILE__
            entry_kvs[:LineNumber]   = __LINE__
          rescue
          end

          TraceView::API.profile(name, entry_kvs, TraceView::Config[:action_view][:collect_backtraces]) do
            render_partial_without_traceview(options)
          end
        else
          render_partial_without_traceview(options)
        end
      end

      alias :render_partial_collection_without_traceview :render_partial_collection
      def render_partial_collection(options = {})
        entry_kvs = {}
        begin
          name  = 'partial_collection'
          entry_kvs[:FunctionName] = :render_partial_collection
          entry_kvs[:Class]        = :Partials
          entry_kvs[:Module]       = :ActionView
          entry_kvs[:File]         = __FILE__
          entry_kvs[:LineNumber]   = __LINE__
        rescue
        end

        TraceView::API.profile(name, entry_kvs, TraceView::Config[:action_view][:collect_backtraces]) do
          render_partial_collection_without_traceview(options)
        end
      end
    end
  end
end

# vim:set expandtab:tabstop=2

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
traceview-3.3.3-java lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.3.3 lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.3.1-java lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.3.1 lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.3.0-java lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.3.0 lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.2.1-java lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.2.1 lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.1.0-java lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.1.0 lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.0.5-java lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.0.5 lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.0.4-java lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.0.4 lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.0.3-java lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.0.3 lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.0.2-java lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.0.2 lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.0.1-java lib/traceview/frameworks/rails/inst/action_view_2x.rb
traceview-3.0.1 lib/traceview/frameworks/rails/inst/action_view_2x.rb