Class: RailsPulse::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rails_pulse/configuration.rb', line 22

def initialize
  @enabled = true
  @route_thresholds = { slow: 500, very_slow: 1500, critical: 3000 }
  @request_thresholds = { slow: 700, very_slow: 2000, critical: 4000 }
  @query_thresholds = { slow: 100, very_slow: 500, critical: 1000 }
  @ignored_routes = []
  @ignored_requests = []
  @ignored_queries = []
  @track_assets = false
  @custom_asset_patterns = []
  @mount_path = nil
  @full_retention_period = 2.weeks
  @archiving_enabled = true
  @max_table_records = {
    rails_pulse_requests: 10000,
    rails_pulse_operations: 50000,
    rails_pulse_routes: 1000,
    rails_pulse_queries: 500
  }
  @connects_to = nil
  @authentication_enabled = Rails.env.production?
  @authentication_method = nil
  @authentication_redirect_path = "/"
  @tags = [ "ignored", "critical", "experimental" ]

  validate_configuration!
end

Instance Attribute Details

#archiving_enabledObject

Returns the value of attribute archiving_enabled.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def archiving_enabled
  @archiving_enabled
end

#authentication_enabledObject

Returns the value of attribute authentication_enabled.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def authentication_enabled
  @authentication_enabled
end

#authentication_methodObject

Returns the value of attribute authentication_method.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def authentication_method
  @authentication_method
end

#authentication_redirect_pathObject

Returns the value of attribute authentication_redirect_path.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def authentication_redirect_path
  @authentication_redirect_path
end

#connects_toObject

Returns the value of attribute connects_to.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def connects_to
  @connects_to
end

#custom_asset_patternsObject

Returns the value of attribute custom_asset_patterns.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def custom_asset_patterns
  @custom_asset_patterns
end

#enabledObject

Returns the value of attribute enabled.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def enabled
  @enabled
end

#full_retention_periodObject

Returns the value of attribute full_retention_period.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def full_retention_period
  @full_retention_period
end

#ignored_queriesObject

Returns the value of attribute ignored_queries.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def ignored_queries
  @ignored_queries
end

#ignored_requestsObject

Returns the value of attribute ignored_requests.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def ignored_requests
  @ignored_requests
end

#ignored_routesObject

Get all routes to ignore, including asset patterns if track_assets is false



51
52
53
# File 'lib/rails_pulse/configuration.rb', line 51

def ignored_routes
  @ignored_routes
end

#max_table_recordsObject

Returns the value of attribute max_table_records.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def max_table_records
  @max_table_records
end

#mount_pathObject

Returns the value of attribute mount_path.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def mount_path
  @mount_path
end

#query_thresholdsObject

Returns the value of attribute query_thresholds.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def query_thresholds
  @query_thresholds
end

#request_thresholdsObject

Returns the value of attribute request_thresholds.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def request_thresholds
  @request_thresholds
end

#route_thresholdsObject

Returns the value of attribute route_thresholds.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def route_thresholds
  @route_thresholds
end

#tagsObject

Returns the value of attribute tags.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def tags
  @tags
end

#track_assetsObject

Returns the value of attribute track_assets.



3
4
5
# File 'lib/rails_pulse/configuration.rb', line 3

def track_assets
  @track_assets
end

Instance Method Details

#revalidate!Object

Revalidate configuration after changes



73
74
75
# File 'lib/rails_pulse/configuration.rb', line 73

def revalidate!
  validate_configuration!
end

#validate_configuration!Object

Validate configuration settings



63
64
65
66
67
68
69
70
# File 'lib/rails_pulse/configuration.rb', line 63

def validate_configuration!
  validate_thresholds!
  validate_retention_settings!
  validate_patterns!
  validate_database_settings!
  validate_authentication_settings!
  validate_tags!
end