Module: DashingContrib::RunnableJob
- Extended by:
- RunnableJob
- Included in:
- Jobs::DashingState, Jobs::Kue, Jobs::NagiosList, Jobs::PingdomUptime, Jobs::Sidekiq, RunnableJob
- Defined in:
- lib/dashing-contrib/runnable_job.rb
Defined Under Namespace
Classes: Context
Constant Summary collapse
- WARNING =
'warning'.freeze
- CRITICAL =
'critical'.freeze
- OK =
'ok'.freeze
Instance Method Summary collapse
-
#metrics(options) ⇒ Object
- Overrides this method to fetch and generate metrics Return value should be the final metrics to be used in the user interface Arguments: options
-
options provided by caller in ‘run` method.
- #run(options = {}, &block) ⇒ Object
-
#validate_state(metrics, user_options) ⇒ Object
- Always return a common state, override this with your custom logic Common states are WARNING, CRITICAL, OK Arguments: metrics
- calculated metrics provided ‘metrics` method user_options
-
hash provided by user options.
Instance Method Details
#metrics(options) ⇒ Object
Overrides this method to fetch and generate metrics Return value should be the final metrics to be used in the user interface Arguments:
:: provided by caller in `run` method
56 57 58 |
# File 'lib/dashing-contrib/runnable_job.rb', line 56 def metrics() {} end |
#run(options = {}, &block) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/dashing-contrib/runnable_job.rb', line 39 def run( = {}, &block) = () interval = .delete(:every) rufus_opt = { first_in: [:first_in] } event_name = .delete(:event) block.call if block_given? Context.new(interval, rufus_opt, event_name, , self).schedule! end |
#validate_state(metrics, user_options) ⇒ Object
Always return a common state, override this with your custom logic Common states are WARNING, CRITICAL, OK Arguments:
metrics :: calculated metrics provided `metrics` method
:: hash provided by user
65 66 67 |
# File 'lib/dashing-contrib/runnable_job.rb', line 65 def validate_state(metrics, ) OK end |