@@ -453,6 +453,7 @@ describe('EndToEnd', () => {
453453 const expectedSpanNames = [
454454 'CloudSpanner.Snapshot.runStream' ,
455455 'CloudSpanner.Snapshot.run' ,
456+ 'CloudSpanner.Transaction.commit' ,
456457 'CloudSpanner.Database.runTransaction' ,
457458 ] ;
458459 assert . deepStrictEqual (
@@ -464,17 +465,18 @@ describe('EndToEnd', () => {
464465 const expectedEventNames = [
465466 'Starting stream' ,
466467 'Transaction Creation Done' ,
468+ 'Starting Commit' ,
469+ 'Commit Done' ,
467470 'Acquiring session' ,
468471 'Cache hit: has usable session' ,
469472 'Acquired session' ,
470- 'Using Session' ,
471- 'Transaction Attempt Succeeded' ,
472473 ] ;
473474 assert . deepStrictEqual (
474475 actualEventNames ,
475476 expectedEventNames ,
476477 `Unexpected events:\n\tGot: ${ actualEventNames } \n\tWant: ${ expectedEventNames } `
477478 ) ;
479+ done ( ) ;
478480 } ) ;
479481 } ) ;
480482
@@ -1516,37 +1518,8 @@ SELECT 1p
15161518 expectedSpanNames ,
15171519 `span names mismatch:\n\tGot: ${ actualSpanNames } \n\tWant: ${ expectedSpanNames } `
15181520 ) ;
1519-
1520- // We need to ensure a strict relationship between the spans.
1521- // |-Database.runTransactionAsync |-------------------------------------|
1522- // |-Snapshot.run |------------------------|
1523- // |-Snapshot.runStream |---------------------|
1524- // |-Transaction.commit |--------|
1525- // |-Snapshot.begin |------|
1526- // |-Snapshot.commit |-----|
1527- const spanDatabaseRunTransactionAsync = spans [ spans . length - 1 ] ;
1528- assert . deepStrictEqual (
1529- spanDatabaseRunTransactionAsync . name ,
1530- 'CloudSpanner.Database.runTransactionAsync' ,
1531- `${ actualSpanNames } `
1532- ) ;
1533- const spanTransactionCommit0 = spans [ spans . length - 2 ] ;
1534- assert . strictEqual (
1535- spanTransactionCommit0 . name ,
1536- 'CloudSpanner.Transaction.commit'
1537- ) ;
1538- assert . deepStrictEqual (
1539- spanTransactionCommit0 . parentSpanId ,
1540- spanDatabaseRunTransactionAsync . spanContext ( ) . spanId ,
1541- 'Expected that Database.runTransaction is the parent to Transaction.commmit'
1542- ) ;
15431521 const spanSnapshotRun = spans [ 2 ] ;
15441522 assert . strictEqual ( spanSnapshotRun . name , 'CloudSpanner.Snapshot.run' ) ;
1545- assert . deepStrictEqual (
1546- spanSnapshotRun . parentSpanId ,
1547- spanDatabaseRunTransactionAsync . spanContext ( ) . spanId ,
1548- 'Expected that Database.runTransaction is the parent to Snapshot.run'
1549- ) ;
15501523 const wantSpanErr = '6 ALREADY_EXISTS: ' + messageBadInsertAlreadyExistent ;
15511524 assert . deepStrictEqual (
15521525 spanSnapshotRun . status . code ,
@@ -1584,6 +1557,38 @@ SELECT 1p
15841557 'Expected that sessionPool.createSessions is the parent to db.batchCreassionSessions'
15851558 ) ;
15861559
1560+ // TODO: Uncomment once we've merged Database.runTransactionAsync tracing.
1561+ // We need to ensure a strict relationship between the spans.
1562+ // |-Database.runTransactionAsync |-------------------------------------|
1563+ // |-Snapshot.run |------------------------|
1564+ // |-Snapshot.runStream |---------------------|
1565+ // |-Transaction.commit |--------|
1566+ // |-Snapshot.begin |------|
1567+ // |-Snapshot.commit |-----|
1568+ /*
1569+ const spanDatabaseRunTransactionAsync = spans[spans.length - 1];
1570+ assert.deepStrictEqual(
1571+ spanDatabaseRunTransactionAsync.name,
1572+ 'CloudSpanner.Database.runTransactionAsync',
1573+ `${actualSpanNames}`
1574+ );
1575+ const spanTransactionCommit0 = spans[spans.length - 1];
1576+ assert.strictEqual(
1577+ spanTransactionCommit0.name,
1578+ 'CloudSpanner.Transaction.commit'
1579+ );
1580+ assert.deepStrictEqual(
1581+ spanTransactionCommit0.parentSpanId,
1582+ spanDatabaseRunTransactionAsync.spanContext().spanId,
1583+ 'Expected that Database.runTransaction is the parent to Transaction.commmit'
1584+ );
1585+
1586+ assert.deepStrictEqual(
1587+ spanSnapshotRun.parentSpanId,
1588+ spanDatabaseRunTransactionAsync.spanContext().spanId,
1589+ 'Expected that Database.runTransaction is the parent to Snapshot.run'
1590+ );
1591+
15871592 // Assert that despite all being exported, SessionPool.createSessions
15881593 // is not in the same trace as runStream, createSessions is invoked at
15891594 // Spanner Client instantiation, thus before database.run is invoked.
@@ -1592,6 +1597,8 @@ SELECT 1p
15921597 spanDatabaseRunTransactionAsync.spanContext().traceId,
15931598 'Did not expect the same traceId'
15941599 );
1600+ */
1601+
15951602 // Finally check for the collective expected event names.
15961603 const expectedEventNames = [
15971604 'Requesting 25 sessions' ,
@@ -1605,6 +1612,9 @@ SELECT 1p
16051612 'Transaction Creation Done' ,
16061613 'Starting Commit' ,
16071614 'Commit Done' ,
1615+
1616+ // TODO: Uncomment once we've merged Database.runTransactionAsync tracing.
1617+ /*
16081618 'Acquiring session',
16091619 'Waiting for a session to become available',
16101620 'Acquired session',
@@ -1613,6 +1623,7 @@ SELECT 1p
16131623 'Transaction Attempt Aborted',
16141624 'exception',
16151625 'exception',
1626+ */
16161627 ] ;
16171628 assert . deepStrictEqual (
16181629 actualEventNames ,
@@ -2144,11 +2155,15 @@ describe('Traces for ExecuteStream broken stream retries', () => {
21442155 'Transaction Creation Done' ,
21452156 'Starting Commit' ,
21462157 'Commit Done' ,
2158+
2159+ // TODO: Uncomment once we've merged Database.runTransactionAsync tracing.
2160+ /*
21472161 'Acquiring session',
21482162 'Waiting for a session to become available',
21492163 'Acquired session',
21502164 'Using Session',
21512165 'Transaction Attempt Succeeded',
2166+ */
21522167 ] ;
21532168 assert . deepStrictEqual (
21542169 actualEventNames ,
@@ -2218,11 +2233,15 @@ describe('Traces for ExecuteStream broken stream retries', () => {
22182233 'Requesting 25 sessions' ,
22192234 'Creating 25 sessions' ,
22202235 'Requested for 25 sessions returned 25' ,
2236+
2237+ // TODO: Uncomment once we've merged Database.runTransactionAsync tracing.
2238+ /*
22212239 'Acquiring session',
22222240 'Waiting for a session to become available',
22232241 'Acquired session',
22242242 'Using Session',
22252243 'Transaction Attempt Succeeded',
2244+ */
22262245 ] ;
22272246 assert . deepStrictEqual (
22282247 actualEventNames ,
0 commit comments