Class: Sidekiq::Instrumental::Configuration
- Inherits:
-
Object
- Object
- Sidekiq::Instrumental::Configuration
- Defined in:
- lib/sidekiq/instrumental/configuration.rb
Overview
Configuration for gem
Constant Summary collapse
- ARRAY_OPTIONS =
%i[ whitelist_queues blacklist_queues whitelist_classes blacklist_classes ].freeze
Instance Attribute Summary collapse
-
#instrumental_agent ⇒ Object
(also: #I)
Returns the value of attribute instrumental_agent.
Instance Method Summary collapse
- #allowed_to_submit(queue, worker_instance) ⇒ Object
- #class_in_blacklist(worker_instance) ⇒ Object
- #class_in_whitelist(worker_instance) ⇒ Object
- #enabled? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #queue_in_blacklist(queue) ⇒ Object
- #queue_in_whitelist(queue) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
17 18 19 20 21 |
# File 'lib/sidekiq/instrumental/configuration.rb', line 17 def initialize @instrumental_agent = nil self.enabled = true ARRAY_OPTIONS.each { |o| send("#{o}=", []) } end |
Instance Attribute Details
#instrumental_agent ⇒ Object Also known as: I
Returns the value of attribute instrumental_agent.
12 13 14 |
# File 'lib/sidekiq/instrumental/configuration.rb', line 12 def instrumental_agent @instrumental_agent end |
Instance Method Details
#allowed_to_submit(queue, worker_instance) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/sidekiq/instrumental/configuration.rb', line 47 def allowed_to_submit(queue, worker_instance) class_in_whitelist(worker_instance) && !class_in_blacklist(worker_instance) && queue_in_whitelist(queue) && !queue_in_blacklist(queue) end |
#class_in_blacklist(worker_instance) ⇒ Object
43 44 45 |
# File 'lib/sidekiq/instrumental/configuration.rb', line 43 def class_in_blacklist(worker_instance) blacklist_classes.include?(worker_instance.class.to_s) end |
#class_in_whitelist(worker_instance) ⇒ Object
37 38 39 40 41 |
# File 'lib/sidekiq/instrumental/configuration.rb', line 37 def class_in_whitelist(worker_instance) whitelist_classes.nil? || whitelist_classes.empty? || whitelist_classes.include?(worker_instance.class.to_s) end |
#enabled? ⇒ Boolean
23 24 25 |
# File 'lib/sidekiq/instrumental/configuration.rb', line 23 def enabled? @enabled && !@instrumental_agent.nil? end |
#queue_in_blacklist(queue) ⇒ Object
33 34 35 |
# File 'lib/sidekiq/instrumental/configuration.rb', line 33 def queue_in_blacklist(queue) blacklist_queues.include?(queue.to_s) end |
#queue_in_whitelist(queue) ⇒ Object
27 28 29 30 31 |
# File 'lib/sidekiq/instrumental/configuration.rb', line 27 def queue_in_whitelist(queue) whitelist_queues.nil? || whitelist_queues.empty? || whitelist_queues.include?(queue.to_s) end |