Sha256: abea2ad75d008b295e03293eb96c4f069186a2cc3555c11420e3625d633754a3

Contents?: true

Size: 598 Bytes

Versions: 6

Compression:

Stored size: 598 Bytes

Contents

# frozen_string_literal: true

module RailsAutoscaleAgent
  class Report

    attr_reader :measurements

    def initialize
      @measurements = []
    end

    def to_params(config)
      {
        dyno: config.dyno,
        pid: config.pid,
      }
    end

    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

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_autoscale_agent-0.9.1 lib/rails_autoscale_agent/report.rb
rails_autoscale_agent-0.9.0 lib/rails_autoscale_agent/report.rb
rails_autoscale_agent-0.9.0.beta.5 lib/rails_autoscale_agent/report.rb
rails_autoscale_agent-0.9.0.beta.4 lib/rails_autoscale_agent/report.rb
rails_autoscale_agent-0.9.0.beta.2 lib/rails_autoscale_agent/report.rb
rails_autoscale_agent-0.9.0.beta.1 lib/rails_autoscale_agent/report.rb