Class: StatsD::Instrument::CaptureSink
- Inherits:
-
Object
- Object
- StatsD::Instrument::CaptureSink
- 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
-
#datagram_class ⇒ Object
readonly
Returns the value of attribute datagram_class.
-
#datagrams ⇒ Object
readonly
Returns the value of attribute datagrams.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #<<(datagram) ⇒ Object
- #clear ⇒ Object
- #flush(blocking:) ⇒ Object
-
#initialize(parent:, datagram_class: StatsD::Instrument::Datagram) ⇒ CaptureSink
constructor
A new instance of CaptureSink.
- #sample?(_sample_rate) ⇒ Boolean
Constructor Details
#initialize(parent:, datagram_class: StatsD::Instrument::Datagram) ⇒ CaptureSink
Returns a new instance of CaptureSink.
10 11 12 13 14 |
# File 'lib/statsd/instrument/capture_sink.rb', line 10 def initialize(parent:, datagram_class: StatsD::Instrument::Datagram) @parent = parent @datagram_class = datagram_class @datagrams = [] end |
Instance Attribute Details
#datagram_class ⇒ Object (readonly)
Returns the value of attribute datagram_class.
8 9 10 |
# File 'lib/statsd/instrument/capture_sink.rb', line 8 def datagram_class @datagram_class end |
#datagrams ⇒ Object (readonly)
Returns the value of attribute datagrams.
8 9 10 |
# File 'lib/statsd/instrument/capture_sink.rb', line 8 def datagrams @datagrams end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
8 9 10 |
# File 'lib/statsd/instrument/capture_sink.rb', line 8 def parent @parent end |
Instance Method Details
#<<(datagram) ⇒ Object
20 21 22 23 24 |
# File 'lib/statsd/instrument/capture_sink.rb', line 20 def <<(datagram) @datagrams << datagram_class.new(datagram) parent << datagram self end |
#clear ⇒ Object
26 27 28 |
# File 'lib/statsd/instrument/capture_sink.rb', line 26 def clear @datagrams.clear end |
#flush(blocking:) ⇒ Object
30 31 32 |
# File 'lib/statsd/instrument/capture_sink.rb', line 30 def flush(blocking:) @parent.flush(blocking: blocking) end |
#sample?(_sample_rate) ⇒ Boolean
16 17 18 |
# File 'lib/statsd/instrument/capture_sink.rb', line 16 def sample?(_sample_rate) true end |