Sha256: 20aba78eafab603ae7fb526707b2ad819996ef4393483c432731bbb216275826

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

# The SuspendedStreamingBuffer class discards pushed segments and records
# the seen metric.  This buffer is installed when the gRPC server returns
# UNIMPLEMENTED (status 12) code as a signal to not reconnect to the server.
module NewRelic::Agent
  module InfiniteTracing
    class SuspendedStreamingBuffer
      include Constants
      extend Forwardable
      def_delegators :@empty_buffer, :empty?, :push

      def initialize(max_size = DEFAULT_QUEUE_SIZE)
        @empty_buffer = NewRelic::EMPTY_ARRAY
      end

      # updates the seen metric and discards the segment
      def <<(segment)
        NewRelic::Agent.increment_metric(SPANS_SEEN_METRIC)
      end

      def transfer(new_buffer)
        # NOOP
      end

      def close_queue
        # NOOP
      end
      alias :flush_queue :close_queue

      def enumerator
        @empty_buffer
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
newrelic-infinite_tracing-8.10.1 lib/infinite_tracing/suspended_streaming_buffer.rb
newrelic-infinite_tracing-8.10.0 lib/infinite_tracing/suspended_streaming_buffer.rb