@@ -49,7 +49,7 @@ def get_trace_segment_params(self, settings, params=None):
4949 _params ["exclusive_duration_millis" ] = 1000.0 * self .exclusive
5050 return _params
5151
52- def span_event (self , settings , base_attrs = None , parent_guid = None , attr_class = dict , ct_exit_spans = None , ct_processing_time = None ):
52+ def span_event (self , settings , base_attrs = None , parent_guid = None , attr_class = dict , ct_exit_spans = None ):
5353 if ct_exit_spans is None :
5454 ct_exit_spans = {}
5555 i_attrs = (base_attrs and base_attrs .copy ()) or attr_class ()
@@ -79,20 +79,16 @@ def span_event(self, settings, base_attrs=None, parent_guid=None, attr_class=dic
7979 u_attrs , settings .attribute_filter , DST_SPAN_EVENTS , attr_class = attr_class
8080 )
8181
82- start_time = time .time ()
8382 if settings .distributed_tracing .drop_inprocess_spans .enabled or settings .distributed_tracing .unique_spans .enabled :
8483 exit_span_attrs_present = attribute .SPAN_ENTITY_RELATIONSHIP_ATTRIBUTES & set (a_attrs )
8584 # If this is the entry node, always return it.
8685 if i_attrs .get ("nr.entryPoint" ):
87- ct_processing_time [0 ] += (time .time () - start_time )
8886 return [i_attrs , u_attrs , {}] if settings .distributed_tracing .minimize_attributes .enabled else [i_attrs , u_attrs , a_attrs ]
8987 # If this is the an LLM node, always return it.
9088 if a_attrs .get ("llm" ) or i_attrs ["name" ].startswith ("Llm/" ):
91- ct_processing_time [0 ] += (time .time () - start_time )
9289 return [i_attrs , u_attrs , {"llm" : True }] if settings .distributed_tracing .minimize_attributes .enabled else [i_attrs , u_attrs , a_attrs ]
9390 # If the span is not an exit span, skip it by returning None.
9491 if not exit_span_attrs_present :
95- ct_processing_time [0 ] += (time .time () - start_time )
9692 return None
9793 # If the span is an exit span but unique spans is enabled, we need to check
9894 # for uniqueness before returning it.
@@ -107,25 +103,22 @@ def span_event(self, settings, base_attrs=None, parent_guid=None, attr_class=dic
107103 if new_exit_span :
108104 u_attrs ["nr.durations" ] = self .duration
109105 ct_exit_spans [span_attrs ] = [u_attrs ]
110- ct_processing_time [0 ] += (time .time () - start_time )
111106 return [i_attrs , u_attrs , a_minimized_attrs ] if settings .distributed_tracing .minimize_attributes .enabled else [i_attrs , u_attrs , a_attrs ]
112107 # If this is an exit span we've already seen, add it's guid to the list
113108 # of ids on the seen span and return None.
114109 # For now add ids to user attributes list
115110 ct_exit_spans [span_attrs ][0 ]["nr.ids" ].append (self .guid )
116111 ct_exit_spans [span_attrs ][0 ]["nr.durations" ] += self .duration
117112
118- ct_processing_time [0 ] += (time .time () - start_time )
119113 return None
120114 elif settings .distributed_tracing .minimize_attributes .enabled :
121115 # Drop all non-entity relationship attributes from the span.
122116 exit_span_attrs_present = attribute .SPAN_ENTITY_RELATIONSHIP_ATTRIBUTES & set (a_attrs )
123117 a_attrs = attr_class ({key : a_attrs [key ] for key in exit_span_attrs_present })
124- ct_processing_time [0 ] += (time .time () - start_time )
125118 return [i_attrs , u_attrs , a_attrs ]
126119
127- def span_events (self , settings , base_attrs = None , parent_guid = None , attr_class = dict , ct_exit_spans = None , ct_processing_time = None ):
128- span = self .span_event (settings , base_attrs = base_attrs , parent_guid = parent_guid , attr_class = attr_class , ct_exit_spans = ct_exit_spans , ct_processing_time = ct_processing_time )
120+ def span_events (self , settings , base_attrs = None , parent_guid = None , attr_class = dict , ct_exit_spans = None ):
121+ span = self .span_event (settings , base_attrs = base_attrs , parent_guid = parent_guid , attr_class = attr_class , ct_exit_spans = ct_exit_spans )
129122 parent_id = parent_guid
130123 if span : # span will be None if the span is an inprocess span or repeated exit span.
131124 yield span
@@ -134,7 +127,7 @@ def span_events(self, settings, base_attrs=None, parent_guid=None, attr_class=di
134127 parent_id = self .guid
135128 for child in self .children :
136129 for event in child .span_events ( # noqa: UP028
137- settings , base_attrs = base_attrs , parent_guid = parent_id , attr_class = attr_class , ct_exit_spans = ct_exit_spans , ct_processing_time = ct_processing_time
130+ settings , base_attrs = base_attrs , parent_guid = parent_id , attr_class = attr_class , ct_exit_spans = ct_exit_spans
138131 ):
139132 if event : # event will be None if the span is an inprocess span or repeated exit span.
140133 yield event
0 commit comments