Class: RailsMemoryProfiler::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_memory_profiler/configuration.rb

Overview

Holds all user-facing settings. Obtain the shared instance via config or set values inside a configure block.

Examples:

RailsMemoryProfiler.configure do |config|
  config.sample_rate           = 5
  config.min_allocated_objects = 1_000
  config.notifiers             = [RailsMemoryProfiler::Notifiers::Console.new]
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/rails_memory_profiler/configuration.rb', line 72

def initialize
  @enabled               = Rails.env.development?
  @sample_rate           = 1
  @store_size            = 100
  @dashboard_enabled     = Rails.env.development?
  @min_allocated_objects = 0
  @ignore_paths          = []
  @ignore_controllers    = []
  @detailed_reports          = false
  @detailed_sample_rate      = 10
  @raise_on_allocation_spike = nil
  @notifiers                 = []
  @log_file                  = nil
end

Instance Attribute Details

#dashboard_enabledObject

Returns the value of attribute dashboard_enabled.



# File 'lib/rails_memory_profiler/configuration.rb', line 24

#detailed_reportsObject

Returns the value of attribute detailed_reports.



# File 'lib/rails_memory_profiler/configuration.rb', line 41

#detailed_sample_rateObject

Returns the value of attribute detailed_sample_rate.



# File 'lib/rails_memory_profiler/configuration.rb', line 46

#enabledObject

Returns the value of attribute enabled.



# File 'lib/rails_memory_profiler/configuration.rb', line 12

#ignore_controllersObject

Returns the value of attribute ignore_controllers.



# File 'lib/rails_memory_profiler/configuration.rb', line 37

#ignore_pathsObject

Returns the value of attribute ignore_paths.



# File 'lib/rails_memory_profiler/configuration.rb', line 32

#log_fileString?

Path to a file where reports are appended as JSON lines. Shortcut for configuring Notifiers::FileLogger manually.

Returns:

  • (String, nil)


66
67
68
69
70
# File 'lib/rails_memory_profiler/configuration.rb', line 66

attr_accessor :enabled, :sample_rate, :store_size, :dashboard_enabled,
:min_allocated_objects, :ignore_paths, :ignore_controllers,
:detailed_reports, :detailed_sample_rate,
:raise_on_allocation_spike,
:notifiers, :log_file

#min_allocated_objectsObject

Returns the value of attribute min_allocated_objects.



# File 'lib/rails_memory_profiler/configuration.rb', line 28

#notifiersObject

Returns the value of attribute notifiers.



# File 'lib/rails_memory_profiler/configuration.rb', line 55

#raise_on_allocation_spikeObject

Returns the value of attribute raise_on_allocation_spike.



# File 'lib/rails_memory_profiler/configuration.rb', line 50

#sample_rateObject

Returns the value of attribute sample_rate.



# File 'lib/rails_memory_profiler/configuration.rb', line 16

#store_sizeObject

Returns the value of attribute store_size.



# File 'lib/rails_memory_profiler/configuration.rb', line 20