Class: Speedshop::Cloudwatch::Sidekiq
- Inherits:
-
Object
- Object
- Speedshop::Cloudwatch::Sidekiq
- Defined in:
- lib/speedshop/cloudwatch/sidekiq.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.setup_lifecycle_hooks ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/speedshop/cloudwatch/sidekiq.rb', line 44 def setup_lifecycle_hooks ::Sidekiq.configure_server do |sidekiq_config| if defined?(Sidekiq::Enterprise) sidekiq_config.on(:leader) do Speedshop::Cloudwatch.configure { |c| c.collectors << :sidekiq } Speedshop::Cloudwatch.start! end else sidekiq_config.on(:startup) do Speedshop::Cloudwatch.configure { |c| c.collectors << :sidekiq } Speedshop::Cloudwatch.start! end end sidekiq_config.on(:quiet) do Speedshop::Cloudwatch.stop! end sidekiq_config.on(:shutdown) do Speedshop::Cloudwatch.stop! end end end |
Instance Method Details
#collect ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/speedshop/cloudwatch/sidekiq.rb', line 32 def collect stats = ::Sidekiq::Stats.new processes = ::Sidekiq::ProcessSet.new.to_a report_stats(stats) report_utilization(processes) report_queue_metrics rescue => e Speedshop::Cloudwatch.log_error("Failed to collect Sidekiq metrics: #{e.}", e) end |