Sha256: 53ab900b970898da60e702d8e620ae93aed30c981f932801de856f8a5903fd8d

Contents?: true

Size: 995 Bytes

Versions: 21

Compression:

Stored size: 995 Bytes

Contents

# frozen_string_literal: true

module WaterDrop
  module Instrumentation
    module Callbacks
      # Creates a callable that we want to run upon each message delivery or failure
      #
      # @note We don't have to provide client_name here as this callback is per client instance
      class Delivery
        # @param producer_id [String] id of the current producer
        # @param monitor [WaterDrop::Instrumentation::Monitor] monitor we are using
        def initialize(producer_id, monitor)
          @producer_id = producer_id
          @monitor = monitor
        end

        # Emits delivery details to the monitor
        # @param delivery_report [Rdkafka::Producer::DeliveryReport] delivery report
        def call(delivery_report)
          @monitor.instrument(
            'message.acknowledged',
            producer_id: @producer_id,
            offset: delivery_report.offset,
            partition: delivery_report.partition
          )
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
waterdrop-2.4.11 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.4.10 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.4.9 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.4.8 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.4.7 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.4.6 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.4.5 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.4.4 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.4.3 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.4.2 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.4.1 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.4.0 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.3.3 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.3.2 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.3.1 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.3.0 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.2.0 lib/waterdrop/instrumentation/callbacks/delivery.rb
waterdrop-2.1.0 lib/water_drop/instrumentation/callbacks/delivery.rb
waterdrop-2.0.7 lib/water_drop/instrumentation/callbacks/delivery.rb
waterdrop-2.0.6 lib/water_drop/instrumentation/callbacks/delivery.rb