Module: HealthMonitor
- Extended by:
- HealthMonitor
- Included in:
- HealthMonitor
- Defined in:
- lib/health_monitor/engine.rb,
lib/health_monitor/monitor.rb,
lib/health_monitor/version.rb,
lib/health_monitor/configuration.rb,
lib/health_monitor/providers/base.rb,
lib/health_monitor/providers/cache.rb,
lib/health_monitor/providers/redis.rb,
lib/health_monitor/providers/resque.rb,
lib/health_monitor/providers/sidekiq.rb,
lib/health_monitor/providers/database.rb,
lib/health_monitor/providers/delayed_job.rb,
app/controllers/health_monitor/health_controller.rb
Defined Under Namespace
Modules: Providers Classes: Configuration, Engine, HealthController
Constant Summary collapse
- STATUSES =
{ ok: 'OK', error: 'ERROR' }.freeze
- VERSION =
'11.0.0'
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
Instance Method Summary collapse
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
13 14 15 |
# File 'lib/health_monitor/monitor.rb', line 13 def configuration @configuration end |
Instance Method Details
#check(request: nil, params: {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/health_monitor/monitor.rb', line 21 def check(request: nil, params: {}) providers = configuration.providers if params[:providers].present? providers = providers.select { |provider| params[:providers].include?(provider.name.downcase) } end results = providers.map { |provider| provider_result(provider, request) } { results: results.map { |c| c.without(:critical) }, status: results.any? { |res| res[:status] != STATUSES[:ok] && res[:critical] } ? :service_unavailable : :ok, timestamp: Time.now.to_formatted_s(:rfc2822) } end |
#configure {|configuration| ... } ⇒ Object
15 16 17 18 19 |
# File 'lib/health_monitor/monitor.rb', line 15 def configure self.configuration ||= Configuration.new yield configuration if block_given? end |