Module: Sidekiq::CloudWatchMetrics
- Defined in:
- lib/sidekiq/cloudwatchmetrics.rb
Defined Under Namespace
Classes: Publisher
Class Method Summary collapse
Class Method Details
.enable!(**kwargs) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sidekiq/cloudwatchmetrics.rb', line 9 def self.enable!(**kwargs) Sidekiq.configure_server do |config| publisher = Publisher.new(**kwargs) # Sidekiq enterprise has a globally unique leader thread, making it # easier to publish the cluster-wide metrics from one place. if defined?(Sidekiq::Enterprise) config.on(:leader) do publisher.start end else # Otherwise pubishing from every node doesn't hurt, it's just wasteful config.on(:startup) do publisher.start end end config.on(:quiet) do publisher.quiet if publisher.running? end config.on(:shutdown) do publisher.stop if publisher.running? end end end |