Module: Rapporteur
- Defined in:
- lib/rapporteur.rb,
lib/rapporteur/checks.rb,
lib/rapporteur/engine.rb,
lib/rapporteur/checker.rb,
lib/rapporteur/version.rb,
lib/rapporteur/revision.rb,
lib/rapporteur/check_list.rb,
lib/rapporteur/message_list.rb,
lib/rapporteur/checker_deprecations.rb,
lib/rapporteur/checks/active_record_check.rb,
app/controllers/rapporteur/statuses_controller.rb,
app/controllers/rapporteur/application_controller.rb
Overview
Rapporteur is a Rails Engine which provides your application with an application status endpoint.
Defined Under Namespace
Modules: CheckerDeprecations, Checks Classes: ApplicationController, CheckList, Checker, Engine, MessageList, Revision, StatusesController
Constant Summary collapse
- VERSION =
'3.8.0'
Class Method Summary collapse
-
.add_check(object_or_nil_with_block = nil, &block) ⇒ Object
Public: Add a pre-built or custom check to your status endpoint.
-
.checker ⇒ Object
Internal: The Checker instance.
-
.clear_checks ⇒ Object
Public: Empties all configured checks from the checker.
-
.run ⇒ Object
Public: This is the primary execution point for this class.
Class Method Details
.add_check(object_or_nil_with_block = nil, &block) ⇒ Object
Public: Add a pre-built or custom check to your status endpoint. These checks are used to test the state of the world of the application, and need only respond to ‘#call`.
Once added, the given check will be called and passed an instance of this checker. If everything is good, do nothing! If there is a problem, use ‘add_error` to add an error message to the checker.
Examples
Rapporteur.add_check { |checker|
checker.add_error("Bad luck.") if rand(2) == 1
}
Returns the Checker instance. Raises ArgumentError if the given check does not respond to call.
34 35 36 |
# File 'lib/rapporteur.rb', line 34 def self.add_check(object_or_nil_with_block = nil, &block) checker.add_check(object_or_nil_with_block, &block) end |
.checker ⇒ Object
Internal: The Checker instance. All toplevel calls on Rapporteur are delgated to this object.
41 42 43 44 45 46 47 48 |
# File 'lib/rapporteur.rb', line 41 def self.checker unless @checker @checker = Checker.new add_check(Checks::RevisionCheck) add_check(Checks::TimeCheck) end @checker end |
.clear_checks ⇒ Object
Public: Empties all configured checks from the checker. This may be useful for testing and for cases where you might’ve built up some basic checks but for one reason or another (environment constraint) need to start from scratch.
Returns the Checker instance.
58 59 60 |
# File 'lib/rapporteur.rb', line 58 def self.clear_checks checker.clear end |
.run ⇒ Object
Public: This is the primary execution point for this class. Use run to exercise the configured checker and collect any application errors or data for rendering.
Returns the Checker instance.
68 69 70 |
# File 'lib/rapporteur.rb', line 68 def self.run checker.run end |