Class: Appsignal::Probes::SidekiqProbe Private

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

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

Defined Under Namespace

Classes: Sidekiq6Adapter, Sidekiq7Adapter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ SidekiqProbe

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 a new instance of SidekiqProbe.



56
57
58
59
60
61
62
63
64
65
# File 'lib/appsignal/probes/sidekiq.rb', line 56

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.internal_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.



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

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)


49
50
51
52
53
54
# File 'lib/appsignal/probes/sidekiq.rb', line 49

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

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

.sidekiq7_and_greater?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)


44
45
46
# File 'lib/appsignal/probes/sidekiq.rb', line 44

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.



68
69
70
71
72
# File 'lib/appsignal/probes/sidekiq.rb', line 68

def call
  track_redis_info
  track_stats
  track_queues
end