Class: Fluent::Plugin::OpentelemetryOutput::BatchProcessor::InvalidRecords
- Inherits:
-
Object
- Object
- Fluent::Plugin::OpentelemetryOutput::BatchProcessor::InvalidRecords
- Defined in:
- lib/fluent/plugin/out_opentelemetry.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
Instance Method Summary collapse
- #add(sample = nil) ⇒ Object
-
#initialize ⇒ InvalidRecords
constructor
A new instance of InvalidRecords.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ InvalidRecords
Returns a new instance of InvalidRecords.
116 117 118 119 |
# File 'lib/fluent/plugin/out_opentelemetry.rb', line 116 def initialize @count = 0 @samples = [] end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
114 115 116 |
# File 'lib/fluent/plugin/out_opentelemetry.rb', line 114 def count @count end |
Instance Method Details
#add(sample = nil) ⇒ Object
121 122 123 124 125 126 127 |
# File 'lib/fluent/plugin/out_opentelemetry.rb', line 121 def add(sample = nil) @count += 1 return if sample.nil? || @samples.size >= MAX_SAMPLES text = sample.byteslice(0, MAX_SAMPLE_BYTESIZE).scrub("") @samples << text unless @samples.include?(text) end |
#to_s ⇒ Object
129 130 131 |
# File 'lib/fluent/plugin/out_opentelemetry.rb', line 129 def to_s @samples.empty? ? @count.to_s : "#{@count} (#{@samples.join(' | ')})" end |