Class: Datadog::OpenFeature::Exposures::Buffer

Inherits:
Core::Buffer::CRuby show all
Defined in:
lib/datadog/open_feature/exposures/buffer.rb

Overview

This class is a buffer for exposure events that evicts at random and keeps track of the number of dropped events

WARNING: This class does not work as intended on JRuby

Constant Summary collapse

DEFAULT_LIMIT =
1_000

Constants inherited from Core::Buffer::CRuby

Core::Buffer::CRuby::FIXNUM_MAX

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Buffer::Random

#close, #closed?, #concat, #empty?, #length, #pop, #push, #unshift

Constructor Details

#initialize(limit = DEFAULT_LIMIT) ⇒ Buffer

Returns a new instance of Buffer.



17
18
19
20
21
22
# File 'lib/datadog/open_feature/exposures/buffer.rb', line 17

def initialize(limit = DEFAULT_LIMIT)
  @dropped = 0
  @dropped_count = 0

  super
end

Instance Attribute Details

#dropped_countObject (readonly)

Returns the value of attribute dropped_count.



15
16
17
# File 'lib/datadog/open_feature/exposures/buffer.rb', line 15

def dropped_count
  @dropped_count
end