Class: Appsignal::Hooks::SidekiqHook 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.
Class Method Summary collapse
- .dependencies_present? ⇒ Boolean private
- .version_5_1_or_higher? ⇒ Boolean private
Instance Method Summary collapse
- #dependencies_present? ⇒ Boolean private
- #install ⇒ Object private
Methods inherited from Hook
#initialize, #installed?, register, #try_to_install
Constructor Details
This class inherits a constructor from Appsignal::Hooks::Hook
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.
17 18 19 |
# File 'lib/appsignal/hooks/sidekiq.rb', line 17 def self.dependencies_present? defined?(::Sidekiq) end |
.version_5_1_or_higher? ⇒ 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.
8 9 10 11 12 13 14 15 |
# File 'lib/appsignal/hooks/sidekiq.rb', line 8 def self.version_5_1_or_higher? @version_5_1_or_higher ||= if dependencies_present? Gem::Version.new(::Sidekiq::VERSION) >= Gem::Version.new("5.1.0") else false end end |
Instance 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.
21 22 23 |
# File 'lib/appsignal/hooks/sidekiq.rb', line 21 def dependencies_present? self.class.dependencies_present? end |
#install ⇒ 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.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/appsignal/hooks/sidekiq.rb', line 25 def install require "appsignal/integrations/sidekiq" Appsignal::Probes.register :sidekiq, Appsignal::Probes::SidekiqProbe ::Sidekiq.configure_server do |config| config.error_handlers << Appsignal::Integrations::SidekiqErrorHandler.new if config.respond_to? :death_handlers config.death_handlers << Appsignal::Integrations::SidekiqDeathHandler.new end config.server_middleware do |chain| if chain.respond_to? :prepend chain.prepend Appsignal::Integrations::SidekiqMiddleware else chain.add Appsignal::Integrations::SidekiqMiddleware end end end end |