Sha256: aaf200319dc5f17b3b2dd2d5d05ec7b95eb46e30939a65e6e0bf91f7851a4f03
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
require 'sqspoller/logger/logger' # This reports the Aws::SQS::QueuePoller stats for each queue and each worker in the log. module SqsPoller module Metrics class SqsStatsReporter # Default reporting delay is 60 seconds DEFAULT_REPORTING_DELAY = 60 def stop @running = false end def initialize(options = {}) @running = true @logger = SqsPoller::Logger.get_new_logger(self.class.name) if options[:queue_controller] == nil raise "Need an agent to report data from" end delay = options[:delay] || DEFAULT_REPORTING_DELAY queue_controller = options[:queue_controller] Thread.new { while @running sleep delay next if queue_controller.pollers.size == 0 queue_controller.pollers.each do |queue_name, pollers| pollers.each.with_index(1) do |poller, index| stats = poller.get_poller_stats next if stats == nil @logger.info("Queue: #{queue_name}, Worker: #{index} started: #{stats.polling_started_at}, requests: #{stats.request_count}, messages: #{stats.received_message_count}, last-timestamp: #{stats.last_message_received_at}") end end end } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fourkites-sqspoller-v2-1.0.0 | lib/sqspoller/metrics/queue_stats_reporter.rb |