This repository was archived by the owner on Jan 21, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 "name" : " trace-agent-system-test" ,
33 "version" : " 1.0.0" ,
44 "dependencies" : {
5- "@google-cloud/datastore" : " ^3 .0.0" ,
5+ "@google-cloud/datastore" : " ^4 .0.0" ,
66 "express" : " ^4.16.3" ,
77 "google-auto-auth" : " ^0.10.0" ,
88 "got" : " ^8.0.0" ,
Original file line number Diff line number Diff line change @@ -31,9 +31,10 @@ if (!process.env.GCLOUD_PROJECT ||
3131const WRITE_CONSISTENCY_DELAY_MS = 20 * 1000 ;
3232const projectId = process . env . GCLOUD_PROJECT ;
3333const keyFilename = process . env . GOOGLE_APPLICATION_CREDENTIALS ;
34+ const EXPECTED_ENDPOINT = 'google.datastore.v1.Datastore/RunQuery' ;
3435
3536// trace-agent must be loaded before everything else.
36- require ( '../' ) . start ( {
37+ const tracer = require ( '../' ) . start ( {
3738 projectId : projectId ,
3839 keyFilename : keyFilename ,
3940 flushDelaySeconds : 1
@@ -142,8 +143,11 @@ describe('express + datastore', () => {
142143 const trace = traces [ 0 ] ;
143144 assert . ok ( trace . spans . length >= 2 , 'should be at least 2 spans: parent, child' ) ;
144145 const parent = trace . spans [ 0 ] ;
145- const child = trace . spans . find ( span =>
146- span . name === 'grpc:/google.datastore.v1.Datastore/RunQuery' ) ;
146+ const child = trace . spans . find ( span => {
147+ const datastoreUrl = `https://datastore.googleapis.com/${ EXPECTED_ENDPOINT } ` ;
148+ return span . name === `grpc:/${ EXPECTED_ENDPOINT } ` ||
149+ span . labels [ tracer . labels . HTTP_URL_LABEL_KEY ] === datastoreUrl ;
150+ } ) ;
147151
148152 assert . strictEqual ( parent . name , testPath , 'should match unique path' ) ;
149153 assert . ok ( child ) ;
You can’t perform that action at this time.
0 commit comments