Sha256: 5f8c3c0dace50246c09dcdc32b1e22b540934e64e8e948ab21c7be467d1728d1
Contents?: true
Size: 995 Bytes
Versions: 3
Compression:
Stored size: 995 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) rescue Rdkafka::RdkafkaError => e raise(e) unless e.code == :unknown_partition raise(::Karafka::Web::Errors::Processing::MissingConsumersMetricsTopicError) end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems