@@ -282,7 +282,7 @@ def to_span_data
282
282
end
283
283
284
284
# @api private
285
- def initialize ( context , parent_context , parent_span , name , kind , parent_span_id , span_limits , span_processors , attributes , links , start_timestamp , resource , instrumentation_scope ) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/ MethodLength, Metrics/PerceivedComplexity
285
+ def initialize ( context , parent_context , parent_span , name , kind , parent_span_id , span_limits , span_processors , attributes , links , start_timestamp , resource , instrumentation_scope ) # rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity
286
286
super ( span_context : context )
287
287
@mutex = Mutex . new
288
288
@name = name
@@ -297,7 +297,7 @@ def initialize(context, parent_context, parent_span, name, kind, parent_span_id,
297
297
@total_recorded_events = 0
298
298
@total_recorded_links = links &.size || 0
299
299
@total_recorded_attributes = attributes &.size || 0
300
- @attributes = attributes . nil? ? nil : Hash [ attributes ] # We need a mutable copy of attributes.
300
+ @attributes = attributes
301
301
trim_span_attributes ( @attributes )
302
302
@events = nil
303
303
@links = trim_links ( links , span_limits . link_count_limit , span_limits . link_attribute_count_limit )
@@ -317,7 +317,7 @@ def initialize(context, parent_context, parent_span, name, kind, parent_span_id,
317
317
# SpanData.
318
318
@monotonic_start_timestamp = monotonic_now
319
319
@realtime_start_timestamp = if parent_span . recording?
320
- relative_realtime ( parent_span . realtime_start_timestamp , parent_span . monotonic_start_timestamp )
320
+ relative_realtime ( parent_span . realtime_start_timestamp , parent_span . monotonic_start_timestamp , @monotonic_start_timestamp )
321
321
else
322
322
realtime_now
323
323
end
@@ -419,15 +419,15 @@ def append_event(events, event) # rubocop:disable Metrics/CyclomaticComplexity,
419
419
def relative_timestamp ( timestamp )
420
420
return time_in_nanoseconds ( timestamp ) unless timestamp . nil?
421
421
422
- relative_realtime ( realtime_start_timestamp , monotonic_start_timestamp )
422
+ relative_realtime ( realtime_start_timestamp , monotonic_start_timestamp , monotonic_now )
423
423
end
424
424
425
425
def time_in_nanoseconds ( timestamp )
426
426
( timestamp . to_r * 1_000_000_000 ) . to_i
427
427
end
428
428
429
- def relative_realtime ( realtime_base , monotonic_base )
430
- realtime_base + ( monotonic_now - monotonic_base )
429
+ def relative_realtime ( realtime_base , monotonic_base , now )
430
+ realtime_base + ( now - monotonic_base )
431
431
end
432
432
433
433
def realtime_now
0 commit comments