Class: StatsD::Instrument::CaptureSink

Inherits:
Object
  • Object
show all
Defined in:
lib/statsd/instrument/capture_sink.rb

Overview

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent:, datagram_class: StatsD::Instrument::Datagram) ⇒ CaptureSink

Returns a new instance of CaptureSink.



8
9
10
11
12
# File 'lib/statsd/instrument/capture_sink.rb', line 8

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

Instance Attribute Details

#datagram_classObject (readonly)

Returns the value of attribute datagram_class.



6
7
8
# File 'lib/statsd/instrument/capture_sink.rb', line 6

def datagram_class
  @datagram_class
end

#datagramsObject (readonly)

Returns the value of attribute datagrams.



6
7
8
# File 'lib/statsd/instrument/capture_sink.rb', line 6

def datagrams
  @datagrams
end

#parentObject (readonly)

Returns the value of attribute parent.



6
7
8
# File 'lib/statsd/instrument/capture_sink.rb', line 6

def parent
  @parent
end

Instance Method Details

#<<(datagram) ⇒ Object



18
19
20
21
22
# File 'lib/statsd/instrument/capture_sink.rb', line 18

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

#clearObject



24
25
26
# File 'lib/statsd/instrument/capture_sink.rb', line 24

def clear
  @datagrams.clear
end

#sample?(_sample_rate) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/statsd/instrument/capture_sink.rb', line 14

def sample?(_sample_rate)
  true
end