@@ -296,7 +296,7 @@ def initialize(context, parent_context, name, kind, parent_span_id, span_limits,
296296 @attributes = attributes . nil? ? nil : Hash [ attributes ] # We need a mutable copy of attributes.
297297 trim_span_attributes ( @attributes )
298298 @events = nil
299- @links = trim_links ( links , span_limits . link_count_limit , span_limits . attribute_per_link_count_limit )
299+ @links = trim_links ( links , span_limits . link_count_limit , span_limits . link_attribute_count_limit )
300300 @span_processors . each { |processor | processor . on_start ( self , parent_context ) }
301301 end
302302
@@ -327,33 +327,33 @@ def truncate_attribute_values(attrs)
327327 attrs
328328 end
329329
330- def trim_links ( links , link_count_limit , attribute_per_link_count_limit ) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
330+ def trim_links ( links , link_count_limit , link_attribute_count_limit ) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
331331 # Fast path (likely) common cases.
332332 return nil if links . nil?
333333
334334 if links . size <= link_count_limit &&
335- links . all? { |link | link . attributes . size <= attribute_per_link_count_limit && Internal . valid_attributes? ( name , 'link' , link . attributes ) }
335+ links . all? { |link | link . attributes . size <= link_attribute_count_limit && Internal . valid_attributes? ( name , 'link' , link . attributes ) }
336336 return links . frozen? ? links : links . clone . freeze
337337 end
338338
339339 # Slow path: trim attributes for each Link.
340340 links . last ( link_count_limit ) . map! do |link |
341341 attrs = Hash [ link . attributes ] # link.attributes is frozen, so we need an unfrozen copy to adjust.
342342 attrs . keep_if { |key , value | Internal . valid_key? ( key ) && Internal . valid_value? ( value ) }
343- excess = attrs . size - attribute_per_link_count_limit
343+ excess = attrs . size - link_attribute_count_limit
344344 excess . times { attrs . shift } if excess . positive?
345345 OpenTelemetry ::Trace ::Link . new ( link . span_context , attrs )
346346 end . freeze
347347 end
348348
349349 def append_event ( events , event ) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
350350 event_count_limit = @span_limits . event_count_limit
351- attribute_per_event_count_limit = @span_limits . attribute_per_event_count_limit
351+ event_attribute_count_limit = @span_limits . event_attribute_count_limit
352352 valid_attributes = Internal . valid_attributes? ( name , 'event' , event . attributes )
353353
354354 # Fast path (likely) common case.
355355 if events . size < event_count_limit &&
356- event . attributes . size <= attribute_per_event_count_limit &&
356+ event . attributes . size <= event_attribute_count_limit &&
357357 valid_attributes
358358 return events << event
359359 end
@@ -362,11 +362,11 @@ def append_event(events, event) # rubocop:disable Metrics/AbcSize, Metrics/Cyclo
362362 excess = events . size + 1 - event_count_limit
363363 events . shift ( excess ) if excess . positive?
364364
365- excess = event . attributes . size - attribute_per_event_count_limit
365+ excess = event . attributes . size - event_attribute_count_limit
366366 if excess . positive? || !valid_attributes
367367 attrs = Hash [ event . attributes ] # event.attributes is frozen, so we need an unfrozen copy to adjust.
368368 attrs . keep_if { |key , value | Internal . valid_key? ( key ) && Internal . valid_value? ( value ) }
369- excess = attrs . size - attribute_per_event_count_limit
369+ excess = attrs . size - event_attribute_count_limit
370370 excess . times { attrs . shift } if excess . positive?
371371 event = Event . new ( event . name , attrs . freeze , event . timestamp )
372372 end
0 commit comments