Class: Promenade::Kafka::AsyncProducerSubscriber

Inherits:
Subscriber
  • Object
show all
Defined in:
lib/promenade/kafka/async_producer_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#buffer_overflow(event) ⇒ Object



39
40
41
# File 'lib/promenade/kafka/async_producer_subscriber.rb', line 39

def buffer_overflow(event)
  Promenade.metric(:kafka_async_producer_buffer_overflows).increment(get_labels(event))
end

#drop_messages(event) ⇒ Object



43
44
45
46
47
48
# File 'lib/promenade/kafka/async_producer_subscriber.rb', line 43

def drop_messages(event)
  client = event.payload.fetch(:client_id)
  message_count = event.payload.fetch(:message_count)

  Promenade.metric(:kafka_async_producer_dropped_messages).increment({ client: client }, message_count)
end

#enqueue_message(event) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/promenade/kafka/async_producer_subscriber.rb', line 28

def enqueue_message(event)
  labels = get_labels(event)
  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

  Promenade.metric(:kafka_async_producer_queue_size).set(labels, queue_size)
  Promenade.metric(:kafka_async_producer_max_queue_size).set(labels, max_queue_size)
  Promenade.metric(:kafka_async_producer_queue_fill_ratio).set(labels, queue_fill_ratio)
end