Module: Rails::Instrumentation::ActiveSupportSubscriber

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

Constant Summary collapse

EVENT_NAMESPACE =
'active_support'.freeze
EVENTS =
%w[
  cache_read
  cache_generate
  cache_fetch_hit
  cache_write
  cache_delete
  cache_exist?
].freeze

Class Method Summary collapse

Methods included from Subscriber

included

Class Method Details

.cache_delete(event) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/rails/instrumentation/subscribers/active_support_subscriber.rb', line 52

def cache_delete(event)
  tags = {
    'key' => event.payload[:key]
  }

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

.cache_exist?(event) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
63
64
65
66
# File 'lib/rails/instrumentation/subscribers/active_support_subscriber.rb', line 60

def cache_exist?(event)
  tags = {
    'key' => event.payload[:key]
  }

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

.cache_fetch_hit(event) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/rails/instrumentation/subscribers/active_support_subscriber.rb', line 36

def cache_fetch_hit(event)
  tags = {
    'key' => event.payload[:key]
  }

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

.cache_generate(event) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/rails/instrumentation/subscribers/active_support_subscriber.rb', line 28

def cache_generate(event)
  tags = {
    'key' => event.payload[:key]
  }

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

.cache_read(event) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/rails/instrumentation/subscribers/active_support_subscriber.rb', line 18

def cache_read(event)
  tags = {
    'key' => event.payload[:key],
    'hit' => event.payload[:hit],
    'super_operation' => event.payload[:super_operation]
  }

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

.cache_write(event) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/rails/instrumentation/subscribers/active_support_subscriber.rb', line 44

def cache_write(event)
  tags = {
    'key' => event.payload[:key]
  }

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