Class: Kafka::Prometheus::FetcherSubscriber
- Inherits:
-
ActiveSupport::Subscriber
- Object
- ActiveSupport::Subscriber
- Kafka::Prometheus::FetcherSubscriber
- Defined in:
- lib/kafka/prometheus.rb
Instance Method Summary collapse
-
#initialize ⇒ FetcherSubscriber
constructor
A new instance of FetcherSubscriber.
- #loop(event) ⇒ Object
Constructor Details
#initialize ⇒ FetcherSubscriber
Returns a new instance of FetcherSubscriber.
299 300 301 302 |
# File 'lib/kafka/prometheus.rb', line 299 def initialize super @queue_size = Prometheus.registry.gauge(:fetcher_queue_size, docstring: 'Queue size', labels: [:client, :group_id]) end |
Instance Method Details
#loop(event) ⇒ Object
304 305 306 307 308 309 310 |
# File 'lib/kafka/prometheus.rb', line 304 def loop(event) queue_size = event.payload.fetch(:queue_size) client = event.payload.fetch(:client_id) group_id = event.payload.fetch(:group_id) @queue_size.set(queue_size, labels: { client: client, group_id: group_id }) end |