Class: InnerPerformance::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/inner_performance/configuration.rb', line 13

def initialize
  @sample_rates = {
    "process_action.action_controller" => 2,
    "perform.active_job" => 100,
  }
  @events_retention = 1.week
  @medium_duration_range = [200, 999]
  @ignore_rules = [
    proc { |event| rand(100_000.0) > (InnerPerformance.configuration.sample_rates[event.name.to_s] * 1000) },
    proc { |event| (event.payload[:job]&.class&.name || "").include?("InnerPerformance") },
  ]
  @cleanup_immediately = false
  @traces_enabled = false
  @ignored_event_names = [
    "SCHEMA",
    "TRANSACTION",
    "ActiveRecord::InternalMetadata Load",
    "ActiveRecord::SchemaMigration Load",
  ]
end

Instance Attribute Details

#cleanup_immediatelyObject

Returns the value of attribute cleanup_immediately.



5
6
7
# File 'lib/inner_performance/configuration.rb', line 5

def cleanup_immediately
  @cleanup_immediately
end

#events_retentionObject

Returns the value of attribute events_retention.



5
6
7
# File 'lib/inner_performance/configuration.rb', line 5

def events_retention
  @events_retention
end

#ignore_rulesObject

Returns the value of attribute ignore_rules.



5
6
7
# File 'lib/inner_performance/configuration.rb', line 5

def ignore_rules
  @ignore_rules
end

#ignored_event_namesObject

Returns the value of attribute ignored_event_names.



5
6
7
# File 'lib/inner_performance/configuration.rb', line 5

def ignored_event_names
  @ignored_event_names
end

#medium_duration_rangeObject

Returns the value of attribute medium_duration_range.



5
6
7
# File 'lib/inner_performance/configuration.rb', line 5

def medium_duration_range
  @medium_duration_range
end

#sample_ratesObject

Returns the value of attribute sample_rates.



5
6
7
# File 'lib/inner_performance/configuration.rb', line 5

def sample_rates
  @sample_rates
end

#traces_enabledObject

Returns the value of attribute traces_enabled.



5
6
7
# File 'lib/inner_performance/configuration.rb', line 5

def traces_enabled
  @traces_enabled
end