123456789_123456789_123456789_123456789_123456789_

Class: ActionView::StructuredEventSubscriber

Do not use. This class is for internal use only.
Relationships & Source Files
Namespace Children
Modules:
Classes:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: ActiveSupport::StructuredEventSubscriber
Defined in: actionview/lib/action_view/structured_event_subscriber.rb

Constant Summary

Class Attribute Summary

::ActiveSupport::StructuredEventSubscriber - Inherited

::ActiveSupport::Subscriber - Inherited

.namespace, .notifier, .subscriber,
.event_method_names

::Method names for the ::String patterns attached on this class, frozen and replaced on change so that it can be read concurrently and from other Ractors.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Utils - Included

::ActiveSupport::StructuredEventSubscriber - Inherited

#call,
#emit_debug_event

Like emit_event, but only emits when the event reporter is in debug mode.

#emit_event

Emit a structured event via Rails.event.notify.

#emitting?

Whether any event reporter subscriber would currently consume an event with the given name.

#silenced?, #handle_event_error

::ActiveSupport::Subscriber - Inherited

Constructor Details

This class inherits a constructor from ActiveSupport::StructuredEventSubscriber

Class Attribute Details

.rails_root (rw)

[ GitHub ]

  
# File 'actionview/lib/action_view/structured_event_subscriber.rb', line 52

def rails_root
  Utils.rails_root
end

.rails_root=(rails_root) (rw)

[ GitHub ]

  
# File 'actionview/lib/action_view/structured_event_subscriber.rb', line 56

def rails_root=(rails_root)
  Utils.rails_root = rails_root
end

Class Method Details

.attach_to

[ GitHub ]

  
# File 'actionview/lib/action_view/structured_event_subscriber.rb', line 104

def self.attach_to(*)
  ActiveSupport::Notifications.subscribe("render_template.action_view", Start.new)
  ActiveSupport::Notifications.subscribe("render_layout.action_view", Start.new)

  super
end

Instance Method Details

#render_collection(event)

[ GitHub ]

  
# File 'actionview/lib/action_view/structured_event_subscriber.rb', line 39

def render_collection(event)
  emit_debug_event("action_view.render_collection",
    identifier: from_rails_root(event.payload[:identifier] || "templates"),
    layout: from_rails_root(event.payload[:layout]),
    duration_ms: event.duration.round(2),
    gc_ms: event.gc_time.round(2),
    cache_hits: event.payload[:cache_hits],
    count: event.payload[:count],
  )
end

#render_layout(event)

[ GitHub ]

  
# File 'actionview/lib/action_view/structured_event_subscriber.rb', line 30

def render_layout(event)
  emit_event("action_view.render_layout",
    identifier: from_rails_root(event.payload[:identifier]),
    duration_ms: event.duration.round(2),
    gc_ms: event.gc_time.round(2),
  )
end

#render_partial(event)

[ GitHub ]

  
# File 'actionview/lib/action_view/structured_event_subscriber.rb', line 19

def render_partial(event)
  emit_debug_event("action_view.render_partial",
    identifier: from_rails_root(event.payload[:identifier]),
    layout: from_rails_root(event.payload[:layout]),
    duration_ms: event.duration.round(2),
    gc_ms: event.gc_time.round(2),
    cache_hit: event.payload[:cache_hit],
  )
end

#render_template(event)

[ GitHub ]

  
# File 'actionview/lib/action_view/structured_event_subscriber.rb', line 9

def render_template(event)
  emit_debug_event("action_view.render_template",
    identifier: from_rails_root(event.payload[:identifier]),
    layout: from_rails_root(event.payload[:layout]),
    duration_ms: event.duration.round(2),
    gc_ms: event.gc_time.round(2),
  )
end