@@ -171,8 +171,16 @@ def exists(self):
171171 :rtype: bool
172172 :returns: True if the session exists on the back-end, else False.
173173 """
174+ current_span = get_current_span ()
174175 if self ._session_id is None :
176+ current_span .add_event ("Checking if Session failed due to unset session_id" )
175177 return False
178+
179+ if current_span :
180+ current_span .add_event (
181+ "Checking if Session exists" , {"session.id" : self ._session_id }
182+ )
183+
176184 api = self ._database .spanner_api
177185 metadata = _metadata_with_prefix (self ._database .name )
178186 if self ._database ._route_to_leader_enabled :
@@ -206,8 +214,17 @@ def delete(self):
206214 :raises ValueError: if :attr:`session_id` is not already set.
207215 :raises NotFound: if the session does not exist
208216 """
217+ current_span = get_current_span ()
209218 if self ._session_id is None :
219+ if current_span :
220+ current_span .add_event (
221+ "Deleting Session failed due to unset session_id"
222+ )
210223 raise ValueError ("Session ID not set by back-end" )
224+
225+ if current_span :
226+ current_span .add_event ("Deleting Session" , {"session.id" : self ._session_id })
227+
211228 api = self ._database .spanner_api
212229 metadata = _metadata_with_prefix (self ._database .name )
213230 observability_options = getattr (self ._database , "observability_options" , None )
0 commit comments