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
BASE_TAGS =

rubocop:disable Style/MutableConstant

{ 'component' => 'ActiveSupport' }

Class Method Summary collapse

Methods included from Subscriber

included

Class Method Details

.cache_delete(event) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/rails/instrumentation/subscribers/active_support_subscriber.rb', line 56

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

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

.cache_exist?(event) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
67
68
69
70
# File 'lib/rails/instrumentation/subscribers/active_support_subscriber.rb', line 64

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

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

.cache_fetch_hit(event) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/rails/instrumentation/subscribers/active_support_subscriber.rb', line 40

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

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

.cache_generate(event) ⇒ Object



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

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

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

.cache_read(event) ⇒ Object



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

def cache_read(event)
  tags = span_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



48
49
50
51
52
53
54
# File 'lib/rails/instrumentation/subscribers/active_support_subscriber.rb', line 48

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

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