Module: Rails::Instrumentation::ActionViewSubscriber

Includes:
Subscriber
Defined in:
lib/rails/instrumentation/subscribers/action_view_subscriber.rb

Constant Summary collapse

EVENT_NAMESPACE =
'action_view'.freeze
EVENTS =
%w[
  render_template
  render_partial
  render_collection
].freeze

Class Method Summary collapse

Methods included from Subscriber

included

Class Method Details

.render_collection(event) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/rails/instrumentation/subscribers/action_view_subscriber.rb', line 32

def render_collection(event)
  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

.render_partial(event) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/rails/instrumentation/subscribers/action_view_subscriber.rb', line 24

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

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

.render_template(event) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/rails/instrumentation/subscribers/action_view_subscriber.rb', line 15

def render_template(event)
  tags = {
    'template.identifier' => event.payload[:identifier],
    'template.layout' => event.payload[:layout]
  }

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