Class: Kafka::Statsd::AsyncProducerSubscriber

Inherits:
StatsdSubscriber
  • Object
show all
Defined in:
lib/kafka/statsd.rb

Instance Method Summary collapse

Instance Method Details

#buffer_overflow(event) ⇒ Object



245
246
247
248
249
250
# File 'lib/kafka/statsd.rb', line 245

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) ⇒ Object



252
253
254
255
256
257
# File 'lib/kafka/statsd.rb', line 252

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) ⇒ Object



231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/kafka/statsd.rb', line 231

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