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



267
268
269
270
271
272
# 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) ⇒ Object



274
275
276
277
278
279
# 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) ⇒ Object



253
254
255
256
257
258
259
260
261
262
263
264
265
# 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