Skip to content

Commit 4a1f99c

Browse files
authored
fix(spanner): end spans for read-write methods (#3629)
1 parent 40568de commit 4a1f99c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClientImpl.java

+2
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ public TransactionManager transactionManager(TransactionOption... options) {
294294
span.setStatus(e);
295295
span.end();
296296
throw e;
297+
} finally {
298+
span.end();
297299
}
298300
}
299301

google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -4006,7 +4006,10 @@ public void testTransactionManager_usesOptions() {
40064006
when(pool.getSession()).thenReturn(session);
40074007
TransactionOption option = mock(TransactionOption.class);
40084008

4009-
DatabaseClientImpl client = new DatabaseClientImpl(pool, mock(TraceWrapper.class));
4009+
TraceWrapper traceWrapper =
4010+
new TraceWrapper(Tracing.getTracer(), OpenTelemetry.noop().getTracer(""), false);
4011+
4012+
DatabaseClientImpl client = new DatabaseClientImpl(pool, traceWrapper);
40104013
try (TransactionManager ignore = client.transactionManager(option)) {
40114014
verify(session).transactionManager(option);
40124015
}

0 commit comments

Comments
 (0)