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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 4 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy