Class: BrainzLab::Instrumentation::ActiveStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/brainzlab/instrumentation/active_storage.rb

Constant Summary collapse

SLOW_OPERATION_THRESHOLD =

Thresholds for slow operations (in milliseconds)

500
VERY_SLOW_OPERATION_THRESHOLD =
2000

Class Method Summary collapse

Class Method Details

.install!Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/brainzlab/instrumentation/active_storage.rb', line 11

def install!
  return unless defined?(::ActiveStorage)
  return if @installed

  # Core Active Storage events
  install_preview_subscriber!
  install_transform_subscriber!
  install_analyze_subscriber!

  # Storage service events
  install_service_upload_subscriber!
  install_service_download_subscriber!
  install_service_streaming_download_subscriber!
  install_service_delete_subscriber!
  install_service_delete_prefixed_subscriber!
  install_service_exist_subscriber!
  install_service_url_subscriber!
  install_service_download_chunk_subscriber!
  

  @installed = true
  BrainzLab.debug_log('ActiveStorage instrumentation installed')
end

.installed?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/brainzlab/instrumentation/active_storage.rb', line 35

def installed?
  @installed == true
end