Class: Neetodeploy::Reporter
- Inherits:
-
Object
- Object
- Neetodeploy::Reporter
- Includes:
- NeetoDeploy::Logger
- Defined in:
- lib/neetodeploy/autoscale/reporter.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(metric_value, metric_name, process_type, queue_name = nil, config = Config.instance) ⇒ Reporter
constructor
A new instance of Reporter.
- #report ⇒ Object
Methods included from NeetoDeploy::Logger
Constructor Details
#initialize(metric_value, metric_name, process_type, queue_name = nil, config = Config.instance) ⇒ Reporter
Returns a new instance of Reporter.
13 14 15 16 17 18 19 |
# File 'lib/neetodeploy/autoscale/reporter.rb', line 13 def initialize(metric_value, metric_name, process_type, queue_name = nil, config = Config.instance) @metric_value = metric_value.to_i @config = config @metric_name = metric_name @queue_name = queue_name @process_type = process_type end |
Class Method Details
.report_batch(metrics, process_type, queue_name = nil, config = Config.instance) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/neetodeploy/autoscale/reporter.rb', line 27 def self.report_batch(metrics, process_type, queue_name = nil, config = Config.instance) return if metrics.empty? payload = build_batch_payload(metrics, process_type, queue_name, config) url = config.metrics_server_batch_url NeetoDeploy::Logger.logger.info("Batch reporting #{metrics.size} metrics for #{process_type}") post_batch_request(url, payload, config) end |
Instance Method Details
#report ⇒ Object
21 22 23 24 25 |
# File 'lib/neetodeploy/autoscale/reporter.rb', line 21 def report url = build_url(common_params) logger.info("Reporting #{@metric_name} for #{@process_type}: #{@metric_value}") post_request(url) end |