Skip to content

Commit 97ed577

Browse files
authored
fix: Span events Issue 2166 (#2184)
In this PR we are removing some extra events added for `No session available` and fixing this event for async transaction runner. Fixes #<2166> 🦕
1 parent 46020e6 commit 97ed577

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/database.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,11 +2204,6 @@ class Database extends common.GrpcServiceObject {
22042204
span.addEvent('Using Session', {'session.id': session?.id});
22052205
transaction!._observabilityOptions = this._observabilityOptions;
22062206
this._releaseOnEnd(session!, transaction!, span);
2207-
} else if (isSessionNotFoundError(err as grpc.ServiceError)) {
2208-
span.addEvent('No session available', {
2209-
'session.id': session?.id,
2210-
});
2211-
setSpanError(span, err);
22122207
} else {
22132208
setSpanError(span, err);
22142209
}
@@ -2486,11 +2481,7 @@ class Database extends common.GrpcServiceObject {
24862481
pool.getSession((err, session_) => {
24872482
const span = getActiveOrNoopSpan();
24882483
if (err) {
2489-
if (isSessionNotFoundError(err as grpc.ServiceError)) {
2490-
span.addEvent('No session available', {
2491-
'session.id': session?.id,
2492-
});
2493-
}
2484+
setSpanError(span, err as ServiceError);
24942485
destroyStream(err as ServiceError);
24952486
return;
24962487
}
@@ -3411,10 +3402,11 @@ class Database extends common.GrpcServiceObject {
34113402
this.pool_.release(session);
34123403
}
34133404
} catch (e) {
3414-
if (!isSessionNotFoundError(e as ServiceError)) {
3405+
if (isSessionNotFoundError(e as ServiceError)) {
34153406
span.addEvent('No session available', {
34163407
'session.id': sessionId,
34173408
});
3409+
} else {
34183410
span.end();
34193411
throw e;
34203412
}

0 commit comments

Comments
 (0)