Sha256: 5d002a2d9832282e0daa3843ee4d3876da4717a673be215cadae16a3820236d3

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

module Rails
  module Instrumentation
    module ActionViewSubscriber
      include Subscriber

      EVENT_NAMESPACE = 'action_view'.freeze

      EVENTS = %w[
        render_template
        render_partial
        render_collection
      ].freeze

      # rubocop:disable Style/MutableConstant
      BASE_TAGS = { 'component' => 'ActionView' }
      # rubocop:enable Style/MutableConstant.

      class << self
        def render_template(event)
          tags = span_tags(
            'template.identifier' => event.payload[:identifier],
            'template.layout' => event.payload[:layout]
          )

          Utils.trace_notification(event: event, tags: tags)
        end

        def render_partial(event)
          tags = span_tags(
            'partial.identifier' => event.payload[:identifier]
          )

          Utils.trace_notification(event: event, tags: tags)
        end

        def render_collection(event)
          tags = span_tags(
            'template.identifier' => event.payload[:identifier],
            'template.count' => event.payload[:count]
          )
          tags['template.cache_hits'] = event.payload[:cache_hits] if event.payload.key? :cache_hits

          Utils.trace_notification(event: event, tags: tags)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
signalfx-rails-instrumentation-0.2.1 lib/rails/instrumentation/subscribers/action_view_subscriber.rb
signalfx-rails-instrumentation-0.2.0 lib/rails/instrumentation/subscribers/action_view_subscriber.rb
rails-instrumentation-0.1.5 lib/rails/instrumentation/subscribers/action_view_subscriber.rb
rails-instrumentation-0.1.4 lib/rails/instrumentation/subscribers/action_view_subscriber.rb
rails-instrumentation-0.1.3 lib/rails/instrumentation/subscribers/action_view_subscriber.rb
rails-instrumentation-0.1.2 lib/rails/instrumentation/subscribers/action_view_subscriber.rb