Class: Jaeger::Reporters::RemoteReporter::Buffer

Inherits:
Object
  • Object
show all
Defined in:
lib/jaeger/reporters/remote_reporter/buffer.rb

Instance Method Summary collapse

Constructor Details

#initializeBuffer

Returns a new instance of Buffer.



7
8
9
10
# File 'lib/jaeger/reporters/remote_reporter/buffer.rb', line 7

def initialize
  @buffer = []
  @mutex = Mutex.new
end

Instance Method Details

#<<(element) ⇒ Object



12
13
14
15
16
17
# File 'lib/jaeger/reporters/remote_reporter/buffer.rb', line 12

def <<(element)
  @mutex.synchronize do
    @buffer << element
    true
  end
end

#retrieveObject



19
20
21
22
23
24
25
# File 'lib/jaeger/reporters/remote_reporter/buffer.rb', line 19

def retrieve
  @mutex.synchronize do
    elements = @buffer.dup
    @buffer.clear
    elements
  end
end