Sha256: e2fff4fada4176d249c965803e01ea3109ee8a6f198435bb967ea6efc14d49ec

Contents?: true

Size: 808 Bytes

Versions: 10

Compression:

Stored size: 808 Bytes

Contents

# frozen_string_literal: true

module StatsD
  module Instrument
    # @note This class is part of the new Client implementation that is intended
    #   to become the new default in the next major release of this library.
    class CaptureSink
      attr_reader :parent, :datagrams, :datagram_class

      def initialize(parent:, datagram_class: StatsD::Instrument::Datagram)
        @parent = parent
        @datagram_class = datagram_class
        @datagrams = []
      end

      def sample?(_sample_rate)
        true
      end

      def <<(datagram)
        @datagrams << datagram_class.new(datagram)
        parent << datagram
        self
      end

      def clear
        @datagrams.clear
      end

      def flush(blocking:)
        @parent.flush(blocking: blocking)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
statsd-instrument-3.9.7 lib/statsd/instrument/capture_sink.rb
statsd-instrument-3.9.6 lib/statsd/instrument/capture_sink.rb
statsd-instrument-3.9.5 lib/statsd/instrument/capture_sink.rb
statsd-instrument-3.9.4 lib/statsd/instrument/capture_sink.rb
statsd-instrument-3.9.3 lib/statsd/instrument/capture_sink.rb
statsd-instrument-3.9.2 lib/statsd/instrument/capture_sink.rb
statsd-instrument-3.9.1 lib/statsd/instrument/capture_sink.rb
statsd-instrument-3.9.0 lib/statsd/instrument/capture_sink.rb
statsd-instrument-3.8.0 lib/statsd/instrument/capture_sink.rb
statsd-instrument-3.7.0 lib/statsd/instrument/capture_sink.rb