Class: Speedshop::Cloudwatch::Config
- Inherits:
-
Object
- Object
- Speedshop::Cloudwatch::Config
- Includes:
- Singleton
- Defined in:
- lib/speedshop/cloudwatch/config.rb
Instance Attribute Summary collapse
- #client ⇒ Object
-
#collectors ⇒ Object
Returns the value of attribute collectors.
-
#dimensions ⇒ Object
Returns the value of attribute dimensions.
-
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#metrics ⇒ Object
Returns the value of attribute metrics.
-
#namespaces ⇒ Object
Returns the value of attribute namespaces.
-
#queue_max_size ⇒ Object
Returns the value of attribute queue_max_size.
-
#sidekiq_queues ⇒ Object
Returns the value of attribute sidekiq_queues.
Class Method Summary collapse
Instance Method Summary collapse
- #environment_enabled? ⇒ Boolean
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Config
15 16 17 |
# File 'lib/speedshop/cloudwatch/config.rb', line 15 def initialize reset end |
Instance Attribute Details
#client ⇒ Object
19 20 21 |
# File 'lib/speedshop/cloudwatch/config.rb', line 19 def client @client ||= Aws::CloudWatch::Client.new end |
#collectors ⇒ Object
Returns the value of attribute collectors.
11 12 13 |
# File 'lib/speedshop/cloudwatch/config.rb', line 11 def collectors @collectors end |
#dimensions ⇒ Object
Returns the value of attribute dimensions.
11 12 13 |
# File 'lib/speedshop/cloudwatch/config.rb', line 11 def dimensions @dimensions end |
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments.
11 12 13 |
# File 'lib/speedshop/cloudwatch/config.rb', line 11 def enabled_environments @enabled_environments end |
#environment ⇒ Object
Returns the value of attribute environment.
11 12 13 |
# File 'lib/speedshop/cloudwatch/config.rb', line 11 def environment @environment end |
#interval ⇒ Object
Returns the value of attribute interval.
11 12 13 |
# File 'lib/speedshop/cloudwatch/config.rb', line 11 def interval @interval end |
#logger ⇒ Object
Returns the value of attribute logger.
11 12 13 |
# File 'lib/speedshop/cloudwatch/config.rb', line 11 def logger @logger end |
#metrics ⇒ Object
Returns the value of attribute metrics.
11 12 13 |
# File 'lib/speedshop/cloudwatch/config.rb', line 11 def metrics @metrics end |
#namespaces ⇒ Object
Returns the value of attribute namespaces.
11 12 13 |
# File 'lib/speedshop/cloudwatch/config.rb', line 11 def namespaces @namespaces end |
#queue_max_size ⇒ Object
Returns the value of attribute queue_max_size.
11 12 13 |
# File 'lib/speedshop/cloudwatch/config.rb', line 11 def queue_max_size @queue_max_size end |
#sidekiq_queues ⇒ Object
Returns the value of attribute sidekiq_queues.
11 12 13 |
# File 'lib/speedshop/cloudwatch/config.rb', line 11 def sidekiq_queues @sidekiq_queues end |
Class Method Details
.reset ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/speedshop/cloudwatch/config.rb', line 46 def self.reset if instance_variable_defined?(:@singleton__instance__) config = instance_variable_get(:@singleton__instance__) config&.reset end instance_variable_set(:@singleton__instance__, nil) end |
Instance Method Details
#environment_enabled? ⇒ Boolean
42 43 44 |
# File 'lib/speedshop/cloudwatch/config.rb', line 42 def environment_enabled? enabled_environments.include?(environment) end |
#reset ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/speedshop/cloudwatch/config.rb', line 23 def reset @interval = 60 @queue_max_size = 1000 @client = nil @metrics = { puma: [], sidekiq: [:QueueLatency], rack: [:RequestQueueTime], active_job: [:QueueLatency] } @namespaces = {puma: "Puma", sidekiq: "Sidekiq", rack: "Rack", active_job: "ActiveJob"} @sidekiq_queues = nil @dimensions = {} @logger = (defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger) ? Rails.logger : Logger.new($stdout) @collectors = [] # [:puma, :sidekiq] @enabled_environments = ["production"] @environment = detect_environment end |