Module: Heartcheck
- Defined in:
- lib/heartcheck/app.rb,
lib/heartcheck.rb,
lib/heartcheck/logger.rb,
lib/heartcheck/version.rb,
lib/heartcheck/caching_app.rb,
lib/heartcheck/checks/base.rb,
lib/heartcheck/checks/process.rb,
lib/heartcheck/errors/warning.rb,
lib/heartcheck/executors/base.rb,
lib/heartcheck/checks/firewall.rb,
lib/heartcheck/controllers/dev.rb,
lib/heartcheck/controllers/base.rb,
lib/heartcheck/controllers/info.rb,
lib/heartcheck/caching_app/cache.rb,
lib/heartcheck/checks/watch_file.rb,
lib/heartcheck/services/firewall.rb,
lib/heartcheck/executors/threaded.rb,
lib/heartcheck/controllers/inspect.rb,
lib/heartcheck/errors/routing_error.rb,
lib/heartcheck/generators/generator.rb,
lib/heartcheck/controllers/essential.rb,
lib/heartcheck/controllers/functional.rb,
lib/heartcheck/controllers/environment.rb,
lib/heartcheck/controllers/health_check.rb
Overview
A rack middleware to wrap around App in a cache
Mount an instance of this class passing an app or use this in Rack.
This accepts an optional ttl for the cache that defaults to 300 seconds.
Defined Under Namespace
Modules: Checks, Controllers, Errors, Executors, Services Classes: App, CachingApp, Generator, Logger
Constant Summary collapse
- VERSION =
'2.0.0'.freeze
Class Attribute Summary collapse
- .checks ⇒ Object
-
.executor ⇒ Heartcheck::Executors::Base
an executor class that respond to dispatch(checkers).
-
.logger ⇒ Object
Is used to log some messages when checking if the logger is not set it's returns de default_logger.
Class Method Summary collapse
-
.add(name, options = {}) { ... } ⇒ void
It's used to add an instance of a check to the check list.
-
.dev_checks ⇒ Array<Check>
filter checks that are not functional.
-
.essential_checks ⇒ Array<Check>
filter checks that are essential.
-
.functional_checks ⇒ Array<Check>
filter checks that are functional.
-
.info_checks ⇒ Array<Check>
filter checks that has some information.
-
.setup { ... } ⇒ void
abstract
Is used to configure.
-
.use_threaded_executor! ⇒ Heartcheck::Executors::Threaded
change current executor to a threaded implementation requires 'concurrent-ruby'.
Class Attribute Details
.checks ⇒ Object
14 15 16 |
# File 'lib/heartcheck.rb', line 14 def checks @checks end |
.executor ⇒ Heartcheck::Executors::Base
an executor class that respond to dispatch(checkers)
17 18 19 |
# File 'lib/heartcheck.rb', line 17 def executor @executor end |
.logger ⇒ Object
Is used to log some messages when checking if the logger is not set it's returns de default_logger.
26 27 28 |
# File 'lib/heartcheck.rb', line 26 def logger @logger ||= default_logger end |
Class Method Details
.add(name, options = {}) { ... } ⇒ void
This method returns an undefined value.
It's used to add an instance of a check to the check list
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/heartcheck.rb', line 59 def add(name, = {}, &block) class_name = .fetch(:class) { constantize(name) } instance = Checks.const_get(class_name).new if block_given? checks << instance.tap(&block) else checks << instance end end |
.dev_checks ⇒ Array<Check>
filter checks that are not functional
87 88 89 |
# File 'lib/heartcheck.rb', line 87 def dev_checks checks.select { |ctx| !ctx.functional? } end |
.essential_checks ⇒ Array<Check>
filter checks that are essential
73 74 75 |
# File 'lib/heartcheck.rb', line 73 def essential_checks checks.select { |ctx| !ctx.functional? && !ctx.dev? } end |
.functional_checks ⇒ Array<Check>
filter checks that are functional
80 81 82 |
# File 'lib/heartcheck.rb', line 80 def functional_checks checks.select(&:functional?) end |
.info_checks ⇒ Array<Check>
filter checks that has some information
94 95 96 |
# File 'lib/heartcheck.rb', line 94 def info_checks checks.select { |ctx| ctx.respond_to?(:info) } end |
.setup { ... } ⇒ void
This method returns an undefined value.
Is used to configure.
41 42 43 |
# File 'lib/heartcheck.rb', line 41 def setup yield(self) end |
.use_threaded_executor! ⇒ Heartcheck::Executors::Threaded
change current executor to a threaded implementation requires 'concurrent-ruby'
109 110 111 112 113 114 |
# File 'lib/heartcheck.rb', line 109 def use_threaded_executor! require "concurrent" require "heartcheck/executors/threaded" self.executor = Heartcheck::Executors::Threaded.new end |