Skip to content

Commit

Permalink
fix: session span events
Browse files Browse the repository at this point in the history
  • Loading branch information
surbhigarg92 committed Nov 11, 2024
1 parent fb26cc4 commit cceb81a
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2204,11 +2204,6 @@ class Database extends common.GrpcServiceObject {
span.addEvent('Using Session', {'session.id': session?.id});
transaction!._observabilityOptions = this._observabilityOptions;
this._releaseOnEnd(session!, transaction!, span);
} else if (isSessionNotFoundError(err as grpc.ServiceError)) {
span.addEvent('No session available', {
'session.id': session?.id,
});
setSpanError(span, err);
} else {
setSpanError(span, err);
}
Expand Down Expand Up @@ -2486,11 +2481,7 @@ class Database extends common.GrpcServiceObject {
pool.getSession((err, session_) => {
const span = getActiveOrNoopSpan();
if (err) {
if (isSessionNotFoundError(err as grpc.ServiceError)) {
span.addEvent('No session available', {
'session.id': session?.id,
});
}
setSpanError(span, err as ServiceError);
destroyStream(err as ServiceError);
return;
}
Expand Down Expand Up @@ -3411,10 +3402,11 @@ class Database extends common.GrpcServiceObject {
this.pool_.release(session);
}
} catch (e) {
if (!isSessionNotFoundError(e as ServiceError)) {
if (isSessionNotFoundError(e as ServiceError)) {
span.addEvent('No session available', {
'session.id': sessionId,
});
} else {
span.end();
throw e;
}
Expand Down

0 comments on commit cceb81a

Please sign in to comment.