Class: Sidekiq::Routing::Auto::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/routing/auto/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/sidekiq/routing/auto/configuration.rb', line 37

def initialize
  # Off unless explicitly opted in via SIDEKIQ_ROUTING_AUTO_REROUTE_ENABLED.
  # (In the Rails-engine ancestor this was wired by an initializer; the
  # standalone gem makes it the built-in default so auto stays safe-by-default.)
  @enabled = Sidekiq::Routing::Auto.default_enabled?
  @logger = if defined?(::Rails) && ::Rails.respond_to?(:logger) && ::Rails.logger
    ::Rails.logger
  else
    Logger.new($stdout)
  end
  @sla_thresholds = {
    "within_5_seconds" => 5,
    "within_1_minute" => 60,
    "within_5_minutes" => 300,
    "within_1_hour" => 3600
  }
  @capacity_threshold_percent = 80
  @noisy_neighbor_threshold_percent = 50
  @batch_reroute_limit = 50
  @duration_tracking_window = 3600
  # The internal reroute job must never reroute itself.
  @excluded_job_classes = ["Sidekiq::Routing::Auto::RerouteJob"]
end

Instance Attribute Details

#batch_reroute_limitObject

Returns the value of attribute batch_reroute_limit.



28
29
30
# File 'lib/sidekiq/routing/auto/configuration.rb', line 28

def batch_reroute_limit
  @batch_reroute_limit
end

#capacity_threshold_percentObject

Returns the value of attribute capacity_threshold_percent.



28
29
30
# File 'lib/sidekiq/routing/auto/configuration.rb', line 28

def capacity_threshold_percent
  @capacity_threshold_percent
end

#duration_tracking_windowObject

Returns the value of attribute duration_tracking_window.



28
29
30
# File 'lib/sidekiq/routing/auto/configuration.rb', line 28

def duration_tracking_window
  @duration_tracking_window
end

#enabledObject

Returns the value of attribute enabled.



28
29
30
# File 'lib/sidekiq/routing/auto/configuration.rb', line 28

def enabled
  @enabled
end

#excluded_job_classesObject

Returns the value of attribute excluded_job_classes.



28
29
30
# File 'lib/sidekiq/routing/auto/configuration.rb', line 28

def excluded_job_classes
  @excluded_job_classes
end

#loggerObject

Returns the value of attribute logger.



28
29
30
# File 'lib/sidekiq/routing/auto/configuration.rb', line 28

def logger
  @logger
end

#noisy_neighbor_threshold_percentObject

Returns the value of attribute noisy_neighbor_threshold_percent.



28
29
30
# File 'lib/sidekiq/routing/auto/configuration.rb', line 28

def noisy_neighbor_threshold_percent
  @noisy_neighbor_threshold_percent
end

#sla_thresholdsObject

Returns the value of attribute sla_thresholds.



28
29
30
# File 'lib/sidekiq/routing/auto/configuration.rb', line 28

def sla_thresholds
  @sla_thresholds
end