File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed
opentelemetry-sdk/src/opentelemetry/sdk/trace Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -252,10 +252,6 @@ class Span(trace_api.Span):
252
252
this `Span`.
253
253
"""
254
254
255
- # Initialize these lazily assuming most spans won't have them.
256
- _empty_events = BoundedList (MAX_NUM_EVENTS )
257
- _empty_links = BoundedList (MAX_NUM_LINKS )
258
-
259
255
def __init__ (
260
256
self ,
261
257
name : str ,
@@ -295,15 +291,15 @@ def __init__(
295
291
)
296
292
297
293
if events is None :
298
- self .events = Span . _empty_events
294
+ self .events = BoundedList ( MAX_NUM_EVENTS )
299
295
else :
300
296
self .events = BoundedList (MAX_NUM_EVENTS )
301
297
for event in events :
302
298
self ._filter_attribute_values (event .attributes )
303
299
self .events .append (event )
304
300
305
301
if links is None :
306
- self .links = Span . _empty_links
302
+ self .links = BoundedList ( MAX_NUM_LINKS )
307
303
else :
308
304
self .links = BoundedList .from_seq (MAX_NUM_LINKS , links )
309
305
@@ -438,9 +434,7 @@ def _add_event(self, event: EventBase) -> None:
438
434
if not self .is_recording_events ():
439
435
return
440
436
has_ended = self .end_time is not None
441
- if not has_ended :
442
- if self .events is Span ._empty_events :
443
- self .events = BoundedList (MAX_NUM_EVENTS )
437
+
444
438
if has_ended :
445
439
logger .warning ("Calling add_event() on an ended span." )
446
440
return
You can’t perform that action at this time.
0 commit comments