@@ -33,7 +33,7 @@ import {
3333} from './partial-result-stream' ;
3434import { Session } from './session' ;
3535import { Key } from './table' ;
36- import { getActiveOrNoopSpan } from './instrument' ;
36+ import { Span } from './instrument' ;
3737import { google as spannerClient } from '../protos/protos' ;
3838import {
3939 NormalCallback ,
@@ -499,7 +499,7 @@ export class Snapshot extends EventEmitter {
499499 setSpanError ( span , err ) ;
500500 } else {
501501 this . _updatePrecommitToken ( resp ) ;
502- this . _update ( resp ) ;
502+ this . _update ( resp , span ) ;
503503 }
504504 span . end ( ) ;
505505 callback ! ( err , resp ) ;
@@ -802,7 +802,7 @@ export class Snapshot extends EventEmitter {
802802 ?. on ( 'response' , response => {
803803 this . _updatePrecommitToken ( response ) ;
804804 if ( response . metadata && response . metadata ! . transaction && ! this . id ) {
805- this . _update ( response . metadata ! . transaction ) ;
805+ this . _update ( response . metadata ! . transaction , span ) ;
806806 }
807807 } )
808808 . on ( 'error' , err => {
@@ -1159,7 +1159,7 @@ export class Snapshot extends EventEmitter {
11591159 if ( response . metadata ) {
11601160 metadata = response . metadata ;
11611161 if ( metadata . transaction && ! this . id ) {
1162- this . _update ( metadata . transaction ) ;
1162+ this . _update ( metadata . transaction , span ) ;
11631163 }
11641164 }
11651165 } )
@@ -1406,7 +1406,7 @@ export class Snapshot extends EventEmitter {
14061406 . on ( 'response' , response => {
14071407 this . _updatePrecommitToken ( response ) ;
14081408 if ( response . metadata && response . metadata ! . transaction && ! this . id ) {
1409- this . _update ( response . metadata ! . transaction ) ;
1409+ this . _update ( response . metadata ! . transaction , span ) ;
14101410 }
14111411 } )
14121412 . on ( 'error' , err => {
@@ -1617,13 +1617,15 @@ export class Snapshot extends EventEmitter {
16171617 *
16181618 * @param {spannerClient.spanner.v1.ITransaction } resp Response object.
16191619 */
1620- protected _update ( resp : spannerClient . spanner . v1 . ITransaction ) : void {
1620+ protected _update (
1621+ resp : spannerClient . spanner . v1 . ITransaction ,
1622+ span : Span ,
1623+ ) : void {
16211624 const { id, readTimestamp} = resp ;
16221625
16231626 this . id = id ! ;
16241627 this . metadata = resp ;
16251628
1626- const span = getActiveOrNoopSpan ( ) ;
16271629 span . addEvent ( 'Transaction Creation Done' , { id : this . id . toString ( ) } ) ;
16281630
16291631 if ( readTimestamp ) {
@@ -2071,7 +2073,7 @@ export class Transaction extends Dml {
20712073 const { resultSets, status} = resp ;
20722074 for ( const resultSet of resultSets ) {
20732075 if ( ! this . id && resultSet . metadata ?. transaction ) {
2074- this . _update ( resultSet . metadata . transaction ) ;
2076+ this . _update ( resultSet . metadata . transaction , span ) ;
20752077 }
20762078 }
20772079 const rowCounts : number [ ] = resultSets . map ( ( { stats} ) => {
0 commit comments