Class: Appsignal::Hooks::SidekiqProbe Private
- Defined in:
- lib/appsignal/hooks/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.
Instance Attribute Summary collapse
- #config ⇒ Object readonly private
Instance Method Summary collapse
- #call ⇒ Object private
-
#initialize(config = {}) ⇒ SidekiqProbe
constructor
private
A new instance of SidekiqProbe.
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.
28 29 30 31 32 33 34 |
# File 'lib/appsignal/hooks/sidekiq.rb', line 28 def initialize(config = {}) @config = config @cache = {} config_string = " with config: #{config}" unless config.empty? Appsignal.logger.debug("Initializing Sidekiq probe#{config_string}") require "sidekiq/api" end |
Instance Attribute Details
#config ⇒ Object (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.
26 27 28 |
# File 'lib/appsignal/hooks/sidekiq.rb', line 26 def config @config end |
Instance Method Details
#call ⇒ Object
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.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/appsignal/hooks/sidekiq.rb', line 36 def call stats = ::Sidekiq::Stats.new redis_info = ::Sidekiq.redis_info gauge "worker_count", stats.workers_size gauge "process_count", stats.processes_size gauge "connection_count", redis_info.fetch("connected_clients") gauge "memory_usage", redis_info.fetch("used_memory") gauge "memory_usage_rss", redis_info.fetch("used_memory_rss") gauge_delta :jobs_processed, "job_count", stats.processed, :status => :processed gauge_delta :jobs_failed, "job_count", stats.failed, :status => :failed gauge "job_count", stats.retry_size, :status => :retry_queue gauge_delta :jobs_dead, "job_count", stats.dead_size, :status => :died gauge "job_count", stats.scheduled_size, :status => :scheduled gauge "job_count", stats.enqueued, :status => :enqueued ::Sidekiq::Queue.all.each do |queue| gauge "queue_length", queue.size, :queue => queue.name # Convert latency from seconds to milliseconds gauge "queue_latency", queue.latency * 1_000.0, :queue => queue.name end end |