Class: RailsAutoscaleAgent::Report
- Inherits:
-
Object
- Object
- RailsAutoscaleAgent::Report
- Defined in:
- lib/rails_autoscale_agent/report.rb
Instance Attribute Summary collapse
-
#measurements ⇒ Object
readonly
Returns the value of attribute measurements.
Instance Method Summary collapse
-
#initialize ⇒ Report
constructor
A new instance of Report.
- #to_csv ⇒ Object
- #to_params(config) ⇒ Object
Constructor Details
#initialize ⇒ Report
Returns a new instance of Report.
8 9 10 |
# File 'lib/rails_autoscale_agent/report.rb', line 8 def initialize @measurements = [] end |
Instance Attribute Details
#measurements ⇒ Object (readonly)
Returns the value of attribute measurements.
6 7 8 |
# File 'lib/rails_autoscale_agent/report.rb', line 6 def measurements @measurements end |
Instance Method Details
#to_csv ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rails_autoscale_agent/report.rb', line 19 def to_csv String.new.tap do |result| @measurements.each do |measurement| result << [ measurement.time.to_i, measurement.value, measurement.queue_name, measurement.metric, ].join(',') result << "\n" end end end |
#to_params(config) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/rails_autoscale_agent/report.rb', line 12 def to_params(config) { dyno: config.dyno, pid: config.pid, } end |