Class: RailsHealthChecks::Configuration
- Inherits:
-
Object
- Object
- RailsHealthChecks::Configuration
- Defined in:
- lib/rails_health_checks/configuration.rb
Instance Attribute Summary collapse
-
#allowed_ips ⇒ Object
Returns the value of attribute allowed_ips.
-
#authenticate_block ⇒ Object
readonly
Returns the value of attribute authenticate_block.
- #checks ⇒ Object
-
#custom_checks ⇒ Object
readonly
Returns the value of attribute custom_checks.
-
#disk_critical_threshold ⇒ Object
Returns the value of attribute disk_critical_threshold.
-
#disk_path ⇒ Object
Returns the value of attribute disk_path.
-
#disk_warn_threshold ⇒ Object
Returns the value of attribute disk_warn_threshold.
-
#good_job_latency ⇒ Object
Returns the value of attribute good_job_latency.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#http_expected_status ⇒ Object
Returns the value of attribute http_expected_status.
-
#http_url ⇒ Object
Returns the value of attribute http_url.
-
#memory_threshold ⇒ Object
Returns the value of attribute memory_threshold.
-
#resque_queue_size ⇒ Object
Returns the value of attribute resque_queue_size.
-
#sidekiq_queue_size ⇒ Object
Returns the value of attribute sidekiq_queue_size.
-
#solid_queue_job_count ⇒ Object
Returns the value of attribute solid_queue_job_count.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #authenticate(&block) ⇒ Object
- #disable(name, **opts) ⇒ Object
- #group(name, check_names) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #register(name, check) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rails_health_checks/configuration.rb', line 11 def initialize @checks = [:database] @timeout = 5 @allowed_ips = nil @token = nil @authenticate_block = nil @sidekiq_queue_size = nil @solid_queue_job_count = nil @good_job_latency = nil @resque_queue_size = nil @disk_warn_threshold = nil @disk_critical_threshold = nil @disk_path = "/" @memory_threshold = nil @http_url = nil @http_expected_status = 200 @custom_checks = {} @groups = {} @disabled_checks = {} end |
Instance Attribute Details
#allowed_ips ⇒ Object
Returns the value of attribute allowed_ips.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def allowed_ips @allowed_ips end |
#authenticate_block ⇒ Object (readonly)
Returns the value of attribute authenticate_block.
9 10 11 |
# File 'lib/rails_health_checks/configuration.rb', line 9 def authenticate_block @authenticate_block end |
#checks ⇒ Object
32 33 34 35 |
# File 'lib/rails_health_checks/configuration.rb', line 32 def checks disabled = @disabled_checks.filter_map { |name, envs| name if envs.include?(Rails.env.to_s) } @checks - disabled end |
#custom_checks ⇒ Object (readonly)
Returns the value of attribute custom_checks.
9 10 11 |
# File 'lib/rails_health_checks/configuration.rb', line 9 def custom_checks @custom_checks end |
#disk_critical_threshold ⇒ Object
Returns the value of attribute disk_critical_threshold.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def disk_critical_threshold @disk_critical_threshold end |
#disk_path ⇒ Object
Returns the value of attribute disk_path.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def disk_path @disk_path end |
#disk_warn_threshold ⇒ Object
Returns the value of attribute disk_warn_threshold.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def disk_warn_threshold @disk_warn_threshold end |
#good_job_latency ⇒ Object
Returns the value of attribute good_job_latency.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def good_job_latency @good_job_latency end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
9 10 11 |
# File 'lib/rails_health_checks/configuration.rb', line 9 def groups @groups end |
#http_expected_status ⇒ Object
Returns the value of attribute http_expected_status.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def http_expected_status @http_expected_status end |
#http_url ⇒ Object
Returns the value of attribute http_url.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def http_url @http_url end |
#memory_threshold ⇒ Object
Returns the value of attribute memory_threshold.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def memory_threshold @memory_threshold end |
#resque_queue_size ⇒ Object
Returns the value of attribute resque_queue_size.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def resque_queue_size @resque_queue_size end |
#sidekiq_queue_size ⇒ Object
Returns the value of attribute sidekiq_queue_size.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def sidekiq_queue_size @sidekiq_queue_size end |
#solid_queue_job_count ⇒ Object
Returns the value of attribute solid_queue_job_count.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def solid_queue_job_count @solid_queue_job_count end |
#timeout ⇒ Object
Returns the value of attribute timeout.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def timeout @timeout end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/rails_health_checks/configuration.rb', line 6 def token @token end |
Instance Method Details
#authenticate(&block) ⇒ Object
37 38 39 |
# File 'lib/rails_health_checks/configuration.rb', line 37 def authenticate(&block) @authenticate_block = block end |
#disable(name, **opts) ⇒ Object
41 42 43 44 45 |
# File 'lib/rails_health_checks/configuration.rb', line 41 def disable(name, **opts) envs = Array(opts.fetch(:in)).map(&:to_s) @disabled_checks[name] ||= [] @disabled_checks[name].concat(envs) end |
#group(name, check_names) ⇒ Object
47 48 49 |
# File 'lib/rails_health_checks/configuration.rb', line 47 def group(name, check_names) @groups[name] = check_names end |
#register(name, check) ⇒ Object
51 52 53 54 |
# File 'lib/rails_health_checks/configuration.rb', line 51 def register(name, check) @custom_checks[name] = check @checks << name unless @checks.include?(name) end |