Sha256: e034c6839a353d0d5859df1354d5a9b376e5da770cd3748928e16782b50c037b

Contents?: true

Size: 690 Bytes

Versions: 2

Compression:

Stored size: 690 Bytes

Contents

module Harness
  class SidekiqQueue
    class SendGauge < Job
      include Sidekiq::Worker
      sidekiq_options :queue => :metrics

      def perform(attributes)
        gauge = Gauge.new attributes
        log gauge
      end
    end

    class SendCounter < Job
      include Sidekiq::Worker
      sidekiq_options :queue => :metrics

      def perform(attributes)
        counter = Counter.new attributes
        log counter
      end
    end

    def self.push(measurement)
      if measurement.is_a? Gauge
        SendGauge.perform_async measurement.attributes
      elsif measurement.is_a? Counter
        SendCounter.perform_async measurement.attributes
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
harness-0.3.0 lib/harness/queues/sidekiq_queue.rb
harness-0.2.16 lib/harness/queues/sidekiq_queue.rb