Class: DynoscaleRuby::Worker::Sidekiq

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/dynoscale_ruby/worker/sidekiq.rb

Class Method Summary collapse

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
# File 'lib/dynoscale_ruby/worker/sidekiq.rb', line 8

def self.enabled?
  return false if ENV['SKIP_DYNOSCALE_AGENT']

  require 'sidekiq/api'
  true
rescue LoadError
  false
end

.nameObject



27
28
29
# File 'lib/dynoscale_ruby/worker/sidekiq.rb', line 27

def self.name
   'sidekiq'
end

.queue_latenciesObject



17
18
19
20
21
# File 'lib/dynoscale_ruby/worker/sidekiq.rb', line 17

def self.queue_latencies
  queues.map do |queue|
    [queue.name, (queue.latency * 1000).ceil, queue.size]
	end
end

.queues(source = ::Sidekiq::Queue.all) ⇒ Object



23
24
25
# File 'lib/dynoscale_ruby/worker/sidekiq.rb', line 23

def self.queues(source = ::Sidekiq::Queue.all)
  @@queues ||= source
end