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.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/rails_pulse/configuration.rb', line 32

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 }
  @job_thresholds = { slow: 5_000, very_slow: 30_000, critical: 60_000 }
  @ignored_routes = []
  @ignored_requests = []
  @ignored_queries = []
  @ignored_jobs = []
  @ignored_queues = []
  @track_assets = false
  @track_jobs = false
  @custom_asset_patterns = []
  @mount_path = nil
  @full_retention_period = 30.days
  @archiving_enabled = true
  @max_table_records = {
    rails_pulse_operations: 100_000,
    rails_pulse_requests: 50_000,
    rails_pulse_job_runs: 50_000,
    rails_pulse_queries: 10_000,
    rails_pulse_routes: 1_000,
    rails_pulse_jobs: 1_000
  }
  @connects_to = nil
  @authentication_enabled = Rails.env.production?
  @authentication_method = nil
  @authentication_redirect_path = "/"
  @tags = [ "ignored", "critical", "experimental" ]
  @job_tracking_mode = :universal
  @job_adapters = {
    sidekiq: { enabled: true, track_queue_depth: false },
    solid_queue: { enabled: true, track_recurring: false },
    good_job: { enabled: true, track_cron: false },
    delayed_job: { enabled: true },
    resque: { enabled: true }
  }
  @capture_job_arguments = false

  # Dashboard settings
  @mount_dashboard = true
  @logger = nil

  # Tracking mode settings
  @async = true
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

#asyncObject

Returns the value of attribute async.



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

def async
  @async
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

#capture_job_argumentsObject

Returns the value of attribute capture_job_arguments.



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

def capture_job_arguments
  @capture_job_arguments
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_jobsObject

Returns the value of attribute ignored_jobs.



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

def ignored_jobs
  @ignored_jobs
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_queuesObject

Returns the value of attribute ignored_queues.



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

def ignored_queues
  @ignored_queues
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



81
82
83
# File 'lib/rails_pulse/configuration.rb', line 81

def ignored_routes
  @ignored_routes
end

#job_adaptersObject

Returns the value of attribute job_adapters.



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

def job_adapters
  @job_adapters
end

#job_thresholdsObject

Returns the value of attribute job_thresholds.



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

def job_thresholds
  @job_thresholds
end

#job_tracking_modeObject

Returns the value of attribute job_tracking_mode.



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

def job_tracking_mode
  @job_tracking_mode
end

#loggerObject

Returns the value of attribute logger.



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

def logger
  @logger
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_dashboardObject

Returns the value of attribute mount_dashboard.



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

def mount_dashboard
  @mount_dashboard
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

#track_jobsObject

Returns the value of attribute track_jobs.



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

def track_jobs
  @track_jobs
end

Instance Method Details

#validate_configuration!Object

Validate configuration settings



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/rails_pulse/configuration.rb', line 93

def validate_configuration!
  validate_thresholds!
  validate_retention_settings!
  validate_patterns!
  validate_database_settings!
  validate_authentication_settings!
  validate_tags!
  validate_job_settings!
  validate_dashboard_settings!
  validate_tracking_settings!
end