Sha256: ed20a2bba482dade19571929602d8528e72786d595195b6363a5af727955eccd
Contents?: true
Size: 699 Bytes
Versions: 19
Compression:
Stored size: 699 Bytes
Contents
# frozen_string_literal: true module Sbmt module KafkaConsumer module Instrumentation class ChainableMonitor < BaseMonitor attr_reader :monitors def initialize(monitors = []) super() @monitors = monitors end def instrument(event_id, payload = EMPTY_HASH, &block) return super if monitors.empty? chain = monitors.map { |monitor| monitor.new(event_id, payload) } traverse_chain = proc do if chain.empty? super else chain.shift.trace(&traverse_chain) end end traverse_chain.call end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems