module Judoscale
  class JobMetricsCollector
    # TODO: the worker adapters will be refactored into job collectors, for now this allows us to
    # wrap that implementation temporarily to aid the refactoring and build the interfaces we want.
    def initialize(worker_adapter)
      @worker_adapter = worker_adapter
      super()
    end

    def collect
      store = []
      worker_adapter.collect!(store)
      store.map! { |args| Metric.new(*args) }
      store
    end
  end
end

module Judoscale
  class JobMetricsCollector
    # TODO: the worker adapters will be refactored into job collectors, for now this allows us to
    # wrap that implementation temporarily to aid the refactoring and build the interfaces we want.
    def initialize(worker_adapter)
      @worker_adapter = worker_adapter
      super()
    end

    def collect
      store = []
      worker_adapter.collect!(store)
      store.map! { |(identifier, value, time, queue_name)| Metric.new(identifier, time, value, name) }
      store
    end
  end
end

Fix building the metrics for the worker adapters in the job collector
Fix building the metrics for the worker adapters in the job collector

Because the metric arguments are reversed between the metrics store and
the metrics object, we can't just blindly pass them over, we need to
build the object with individual arguments in the right positions for
now.
