class Kafka::Statsd::AsyncProducerSubscriber

Public Instance Methods

buffer_overflow(event) click to toggle source
# File lib/kafka/statsd.rb, line 267
def buffer_overflow(event)
  client = event.payload.fetch(:client_id)
  topic = event.payload.fetch(:topic)

  increment("async_producer.#{client}.#{topic}.produce.errors")
end
drop_messages(event) click to toggle source
# File lib/kafka/statsd.rb, line 274
def drop_messages(event)
  client = event.payload.fetch(:client_id)
  message_count = event.payload.fetch(:message_count)

  count("async_producer.#{client}.dropped_messages", message_count)
end
enqueue_message(event) click to toggle source
# File lib/kafka/statsd.rb, line 253
def enqueue_message(event)
  client = event.payload.fetch(:client_id)
  topic = event.payload.fetch(:topic)
  queue_size = event.payload.fetch(:queue_size)
  max_queue_size = event.payload.fetch(:max_queue_size)
  queue_fill_ratio = queue_size.to_f / max_queue_size.to_f

  # This gets us the avg/max queue size per producer.
  timing("async_producer.#{client}.#{topic}.queue.size", queue_size)

  # This gets us the avg/max queue fill ratio per producer.
  timing("async_producer.#{client}.#{topic}.queue.fill_ratio", queue_fill_ratio)
end