Class: Appsignal::Probes::SidekiqProbe

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/appsignal/probes/sidekiq.rb

Defined Under Namespace

Classes: Sidekiq6Adapter, Sidekiq7Adapter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ SidekiqProbe

Returns a new instance of SidekiqProbe.



53
54
55
56
57
58
59
60
61
62
# File 'lib/appsignal/probes/sidekiq.rb', line 53

def initialize(config = {})
  @config = config
  @cache = {}
  is_sidekiq7 = self.class.sidekiq7_and_greater?
  @adapter = is_sidekiq7 ? Sidekiq7Adapter : Sidekiq6Adapter

  config_string = " with config: #{config}" unless config.empty?
  Appsignal.logger.debug("Initializing Sidekiq probe#{config_string}")
  require "sidekiq/api"
end

Instance Attribute Details

#configObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/appsignal/probes/sidekiq.rb', line 39

def config
  @config
end

Class Method Details

.dependencies_present?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


46
47
48
49
50
51
# File 'lib/appsignal/probes/sidekiq.rb', line 46

def self.dependencies_present?
  return true if sidekiq7_and_greater?
  return unless defined?(::Redis::VERSION) # Sidekiq <= 6

  Gem::Version.new(::Redis::VERSION) >= Gem::Version.new("3.3.5")
end

.sidekiq7_and_greater?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/appsignal/probes/sidekiq.rb', line 41

def self.sidekiq7_and_greater?
  Gem::Version.new(::Sidekiq::VERSION) >= Gem::Version.new("7.0.0")
end

Instance Method Details

#callObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



65
66
67
68
69
# File 'lib/appsignal/probes/sidekiq.rb', line 65

def call
  track_redis_info
  track_stats
  track_queues
end