Class: Bipbip::Plugin::Gearman
- Inherits:
-
Bipbip::Plugin
- Object
- Bipbip::Plugin
- Bipbip::Plugin::Gearman
- Defined in:
- lib/bipbip/plugin/gearman.rb
Instance Attribute Summary
Attributes inherited from Bipbip::Plugin
#config, #frequency, #metric_group, #name, #tags
Instance Method Summary collapse
Methods inherited from Bipbip::Plugin
factory, factory_from_plugin, #initialize, #metrics_names, #run, #source_identifier
Methods included from InterruptibleSleep
#interrupt_sleep, #interruptible_sleep
Constructor Details
This class inherits a constructor from Bipbip::Plugin
Instance Method Details
#metrics_schema ⇒ Object
7 8 9 10 11 |
# File 'lib/bipbip/plugin/gearman.rb', line 7 def metrics_schema [ { name: 'jobs_queued_total', type: 'gauge', unit: 'Jobs' } ] end |
#monitor ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bipbip/plugin/gearman.rb', line 13 def monitor gearman = GearmanServer.new(config['hostname'] + ':' + config['port'].to_s) stats = gearman.status jobs_queued_total = 0 stats.each do |_function_name, data| data.each do |queue, _stats| jobs_queued_total += queue.to_i end end { jobs_queued_total: jobs_queued_total } end |