Skip to content

Commit

Permalink
Address merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
odeke-em committed Oct 21, 2024
1 parent 5fef320 commit 03a6298
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions observability-test/spanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ describe('EndToEnd', () => {
);

const expectedEventNames = [
'Starting stream',
'Transaction Creation Done',
'Acquiring session',
'Cache hit: has usable session',
Expand Down Expand Up @@ -1558,6 +1559,7 @@ SELECT 1p
'CloudSpanner.Snapshot.begin',
'CloudSpanner.Transaction.commit',
'CloudSpanner.Transaction.commit',
'CloudSpanner.Database.runTransactionAsync',
];
assert.deepStrictEqual(
actualSpanNames,
Expand Down Expand Up @@ -1603,22 +1605,20 @@ SELECT 1p
'Expected that sessionPool.createSessions is the parent to db.batchCreassionSessions'
);

// TODO: Uncomment once we've merged Database.runTransactionAsync tracing.
// We need to ensure a strict relationship between the spans.
// |-Database.runTransactionAsync |-------------------------------------|
// |-Snapshot.run |------------------------|
// |-Snapshot.runStream |---------------------|
// |-Transaction.commit |--------|
// |-Snapshot.begin |------|
// |-Snapshot.commit |-----|
/*
const spanDatabaseRunTransactionAsync = spans[spans.length - 1];
assert.deepStrictEqual(
spanDatabaseRunTransactionAsync.name,
'CloudSpanner.Database.runTransactionAsync',
`${actualSpanNames}`
);
const spanTransactionCommit0 = spans[spans.length - 1];
const spanTransactionCommit0 = spans[spans.length - 2];
assert.strictEqual(
spanTransactionCommit0.name,
'CloudSpanner.Transaction.commit'
Expand All @@ -1643,7 +1643,6 @@ SELECT 1p
spanDatabaseRunTransactionAsync.spanContext().traceId,
'Did not expect the same traceId'
);
*/

// Finally check for the collective expected event names.
const expectedEventNames = [
Expand All @@ -1658,18 +1657,11 @@ SELECT 1p
'Transaction Creation Done',
'Starting Commit',
'Commit Done',

// TODO: Uncomment once we've merged Database.runTransactionAsync tracing.
/*
'Acquiring session',
'Waiting for a session to become available',
'Acquired session',
'Using Session',
'Transaction Attempt Failed',
'Transaction Attempt Aborted',
'exception',
'exception',
*/
];
assert.deepStrictEqual(
actualEventNames,
Expand Down Expand Up @@ -2183,6 +2175,7 @@ describe('Traces for ExecuteStream broken stream retries', () => {
'CloudSpanner.Snapshot.begin',
'CloudSpanner.Transaction.commit',
'CloudSpanner.Transaction.commit',
'CloudSpanner.Database.runTransactionAsync',
];
assert.deepStrictEqual(
actualSpanNames,
Expand All @@ -2201,15 +2194,10 @@ describe('Traces for ExecuteStream broken stream retries', () => {
'Transaction Creation Done',
'Starting Commit',
'Commit Done',

// TODO: Uncomment once we've merged Database.runTransactionAsync tracing.
/*
'Acquiring session',
'Waiting for a session to become available',
'Acquired session',
'Using Session',
'Transaction Attempt Succeeded',
*/
];
assert.deepStrictEqual(
actualEventNames,
Expand Down Expand Up @@ -2268,6 +2256,7 @@ describe('Traces for ExecuteStream broken stream retries', () => {
const expectedSpanNames = [
'CloudSpanner.Database.batchCreateSessions',
'CloudSpanner.SessionPool.createSessions',
'CloudSpanner.Database.runTransactionAsync',
];
assert.deepStrictEqual(
actualSpanNames,
Expand All @@ -2279,15 +2268,10 @@ describe('Traces for ExecuteStream broken stream retries', () => {
'Requesting 25 sessions',
'Creating 25 sessions',
'Requested for 25 sessions returned 25',

// TODO: Uncomment once we've merged Database.runTransactionAsync tracing.
/*
'Acquiring session',
'Waiting for a session to become available',
'Acquired session',
'Using Session',
'Transaction Attempt Succeeded',
*/
];
assert.deepStrictEqual(
actualEventNames,
Expand Down

0 comments on commit 03a6298

Please sign in to comment.