Class: ActiveStorage::StructuredEventSubscriber

Inherits:
ActiveSupport::StructuredEventSubscriber
  • Object
show all
Defined in:
lib/active_storage/structured_event_subscriber.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#preview(event) ⇒ Object



29
30
31
32
33
34
# File 'lib/active_storage/structured_event_subscriber.rb', line 29

def preview(event)
  emit_event("active_storage.preview",
    key: event.payload[:key],
    duration_ms: event.duration.round(2),
  )
end

#service_delete(event) ⇒ Object



36
37
38
39
40
41
# File 'lib/active_storage/structured_event_subscriber.rb', line 36

def service_delete(event)
  emit_event("active_storage.service_delete",
    key: event.payload[:key],
    duration_ms: event.duration.round(2),
  )
end

#service_delete_prefixed(event) ⇒ Object



43
44
45
46
47
48
# File 'lib/active_storage/structured_event_subscriber.rb', line 43

def service_delete_prefixed(event)
  emit_event("active_storage.service_delete_prefixed",
    prefix: event.payload[:prefix],
    duration_ms: event.duration.round(2),
  )
end

#service_download(event) ⇒ Object



15
16
17
18
19
20
# File 'lib/active_storage/structured_event_subscriber.rb', line 15

def service_download(event)
  emit_event("active_storage.service_download",
    key: event.payload[:key],
    duration_ms: event.duration.round(2),
  )
end

#service_exist(event) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/active_storage/structured_event_subscriber.rb', line 50

def service_exist(event)
  emit_debug_event("active_storage.service_exist",
    key: event.payload[:key],
    exist: event.payload[:exist],
    duration_ms: event.duration.round(2),
  )
end

#service_mirror(event) ⇒ Object



68
69
70
71
72
73
74
# File 'lib/active_storage/structured_event_subscriber.rb', line 68

def service_mirror(event)
  emit_debug_event("active_storage.service_mirror",
    key: event.payload[:key],
    checksum: event.payload[:checksum],
    duration_ms: event.duration.round(2),
  )
end

#service_streaming_download(event) ⇒ Object



22
23
24
25
26
27
# File 'lib/active_storage/structured_event_subscriber.rb', line 22

def service_streaming_download(event)
  emit_event("active_storage.service_streaming_download",
    key: event.payload[:key],
    duration_ms: event.duration.round(2),
  )
end

#service_upload(event) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/active_storage/structured_event_subscriber.rb', line 7

def service_upload(event)
  emit_event("active_storage.service_upload",
    key: event.payload[:key],
    checksum: event.payload[:checksum],
    duration_ms: event.duration.round(2),
  )
end

#service_url(event) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/active_storage/structured_event_subscriber.rb', line 59

def service_url(event)
  emit_debug_event("active_storage.service_url",
    key: event.payload[:key],
    url: event.payload[:url],
    duration_ms: event.duration.round(2),
  )
end