Sha256: f3d1ea71f8feb2a20cd79a2bb04f3500df6b43dbc02d57861bbbcc9faf64dbb5

Contents?: true

Size: 798 Bytes

Versions: 5

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Web
    module Processing
      module Consumers
        # Fetches the current consumers historical metrics data
        class Metrics
          class << self
            # Fetch the current metrics data that is expected to exist
            #
            # @return [Hash] latest (current) aggregated metrics state
            def current!
              metrics_message = ::Karafka::Admin.read_topic(
                Karafka::Web.config.topics.consumers.metrics,
                0,
                1
              ).last

              return metrics_message.payload if metrics_message

              raise(::Karafka::Web::Errors::Processing::MissingConsumersMetricsError)
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
karafka-web-0.7.4 lib/karafka/web/processing/consumers/metrics.rb
karafka-web-0.7.3 lib/karafka/web/processing/consumers/metrics.rb
karafka-web-0.7.2 lib/karafka/web/processing/consumers/metrics.rb
karafka-web-0.7.1 lib/karafka/web/processing/consumers/metrics.rb
karafka-web-0.7.0 lib/karafka/web/processing/consumers/metrics.rb