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



199
200
201
202
203
204
# File 'lib/kafka/statsd.rb', line 199

def buffer_overflow(event)
  client = event.payload.fetch(:client_id)
  topic = event.payload.fetch(:topic)

  increment("async_producer.#{client}.#{topic}.produce.errors")
end

#enqueue_message(event) ⇒ Object



185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/kafka/statsd.rb', line 185

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